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.
To debug this, simply attach before the button is pressed, then set a breakpoint (make sure that you open the appropriate archived file and set the breakpoint there). Use the IsNetworkDeployed property to invoke the System. Deployment.
In the Publish wizard, select Folder. In the Specific target page, select ClickOnce. Enter a path or select Browse to select the publish location. In the Install location page, select where users will install the application from.
ClickOnce and DirectInvoke are supported out of the box for all Windows users. Users that want to disable ClickOnce support can go to edge://flags/#edge-click-once and select Disabled from the dropdown list. You'll have to Restart the browser.
Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application.
You can to debug it after adding such code:
System.Diagnostics.Debugger.Launch();
This will show you a dialog that allows you to select your debugger to attach to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With