Prevent Debug Assembly Deployment Using ClickOnce

I am publishing a ClickOnce application with VS2008, but before each publication I have to switch to Release config manually. This is great, as far as I remember switching. Is there a way to prevent deployment of debug collections? Is there any compiler directive, for example:

#if DEBUG #if ClickOnce #error You cannot publish a debug build #endif #endif 

Or is there a way (without build scripts) to automatically switch to the Release version before publishing?

(I found several similar questions, but I did not like the underders)

thanks

+7
c # deployment clickonce
source share
3 answers

Not sure if this is disapproving, but please see my answer in the appropriate thread:

stack overflow

In short, you can modify project files to check for debugging symbols before publishing, and display an error condition if they are found. This prevents deployment without requiring any .bat files or external processing.

+2
source share

The best solution I've found so far is to write a vs2008 add-in based on: http://msdn.microsoft.com/en-us/library/ms165638.aspx

  public void OnPublishBegin(ref bool pubContinue) { if (pubContinue && _applicationObject.Solution.SolutionBuild.ActiveConfiguration.Name != "Release") { System.Windows.Forms.MessageBox.Show("You can only publish a Release build"); pubContinue = false; } } 

Any other ideas appreciated.

+1
source share

Sorry to tell you this, but there is no way to do this. And jomi is right, you will get a dialog if you change the signature key, but do not change the assembly configuration. You just need to pay close attention when deploying your product.

RobinDotNet
Visit my ClickOnce Blog!

0
source share

All Articles