We have a WPF application that we distribute with click-once deployment. The update feature is exactly what we need for our product. Getting the new build from Development into Production is easy, just publish.
The problem is that we only want Release builds to be published. Config transformation, code optimisation and custom icons are some of the main reasons we want to publish a Release build. Sometimes we forget to change the configuration and a Debug build is released into the wild.
As a safety net we added the BeforePublish build target to the project.
<Target Name="BeforePublish"> <Error Condition="'$(Configuration)'!='Release'" Text="Only Release build can be published" /> </Target>
Now when we try to publish without setting the configuration to Release the build fails.
Since this is a very small project we haven’t setup automated build. The errors should keep us safe for now.