tags:

views:

402

answers:

4

Is there any way to disallow publishing of debug builds with ClickOnce? I only want to allow Release builds through, but right now human error causes a debug build to slip in once in a while.

Edit: Sorry, should've mentioned that we're publishing the build from within Visual Studio.

+1  A: 

AFAIK ClickOnce is perfectly happy with debug builds. We automate our builds which allows us control over whether we produce the ClickOnce artefacts from release or debug. Maybe this approach would help you?

Sean Kearon
A: 

I've thought about that, but right now it's as simple as clicking on the project and clicking Publish. The only modification to the current project I'd like would be to have it verify that it's not a Debug build.

Edit: Also, it's not that ClickOnce isn't happy with a Debug build, but that we use a Debug build to signal the availability of certain debug options.

Daniel Jennings
A: 

Do your publishes through a batch file that does a Release build.

Judah Himango
Sorry, should've mentioned that we're publishing the build from within Visual Studio.
Daniel Jennings
+2  A: 

One thing you can do is add a condition to the .csproj or .vbproj file that MSBuild will check when doing a build.

The condition would check if a publish is occurring and check if the build is a debug build, then do something like run an external tool or otherwise interrupt the build process or cause it to fail.

Judah Himango
Could you provide an example?
LnDCobra