Debugging ClickOnce Deployment Features

I am deploying a C # .NET application using ClickOnce, and I wrote code to update the application programmatically (without using the option in the project publishing settings).

However, I want to test the functionality of this code before deploying it (for obvious reasons). How can I do it? The code has a check to verify that the application is being deployed on the network, and this flag is false when debugging is performed. And access to ApplicationDeployment.CurrentDeployment causes an exception to be thrown.

+4
source share
2 answers

You can debug it after adding this code:

System.Diagnostics.Debugger.Launch(); 

This will show you a dialog that allows you to select your debugger to attach.

+9
source

I wonder if you can publish it on your dev server, run it from there (so that it is counted as deployed on the network), and then bind your IDE to the process? (Debug → Attach to Process)

If your update code works at the beginning of the system, you can enter a pause; for example, I use a boiler room that checks (in Main ) on ctrl + alt and displays an additional debug console (for example, showing web service calls as they arise, which makes it easy to debug connection problems in a live system, strolling users through "hold these keys ... now what does he say when an error occurs? "). By the same logic, you can show MessageBox ("debug moode, attach your debugger now").

+4
source

All Articles