Home / Blog / Prevent ClickOnce publish in DEBUG mode
Prevent ClickOnce publish in DEBUG mode

Prevent ClickOnce publish in DEBUG mode

Any developer using ClickOnce has at least once forgot to switch to Release mode before a publish.

 

You are in a hurry to publish after a critical hotfix and forget to switch from Debug to Release mode in Visual Studio.

Prevent this with a simple BeforePublish script. Modify your project.cs file and put this at the end of the file before the </Project> end tag:

<Target Name="BeforePublish">
<Error Condition="'$(DebugSymbols)' == 'true'" Text="You stupid. Publishing in DEBUG mode!" />
</Target>

Contact