views:

90

answers:

1

I'm deploying a C# .NET application using ClickOnce and I have written code to update the application programatically (not using the option in the publish settings of the project).

However I want to test the functionality of this code before deploying (for obvious reasons). How do I do this? The code has a check to see if the application is network deployed and when running debugging sessions this flag is false. And accessing ApplicationDeployment.CurrentDeployment results in an exception being thrown.

A: 

I wonder if you could publish it to your dev server, run it from there (so it counts as network-deployed), and then attach your IDE to the process? (Debug -> Attach to Process)

If your update code runs early in the system, you can introduce a pause; for example, I tend to use boiler-plate that checks (in Main) for ctrl+alt and displays an additional debugging console (for example, showing web-service calls as they happen, making it easy to debug connectivity issues on a live system by walking users through "hold these keys... now what does it say when the bug happens?"). By the same logic you could show a MessageBox ("debug moode; attach your debugger now").

Marc Gravell
Thanks, I'll try that.
Kristoffer L