Any way to avoid accidentally creating the wrong Visual Studio configuration?

In Visual Studio, I have custom MSBuild actions for different levels - development, production, testing, etc. These scripts will automatically compile everything, replace web.config, and output the code to a location based on the selected configuration. Usually, when I want to run one of these builds on something other than development, I call the build script from the command line.

Although I try to be as diligent as possible, sometimes I (and others working in the solution) accidentally leave the configuration in what they did not want - maybe they switched it to the “intermediate” configuration to see how the code looks from its specific preprocessor directives. Then they press "F5", thinking that they are in development to debug ... and accidentally supersede the busted code.

So the question is, is there a way to have build scripts related to the configuration, but prevent builds for specific configurations from the IDE? Or display a warning? Or am I starting this wrong?

+3
source share
2 answers

, Team Build,

<Error
  Text="No Staging builds except on the Team Build server"
  Condition=" '$(IsDesktopBuild)'=='true' And $(Configuration)='Staging' " />

CruiseControl.NET msbuild, IsDesktopBuild.

Visual Studio msbuild, ,

<Error
  Text="You didn't say the magic word"
  Condition=" '$(MagicWord)'!='please' And $(Configuration)='Staging' " />

msbuild /p:Configuration=Staging /p:MagicWord=please

Visual Studio , .

+3

Task Class MSBuild.

0

Source: https://habr.com/ru/post/1703600/


All Articles