For C++ projects I can do this:
SET CL=/DMYDIRECTIVE
devenv.exe MySolution.sln /rebuild
What is the C# version (visual studio 2008) of this trick?
For C++ projects I can do this:
SET CL=/DMYDIRECTIVE
devenv.exe MySolution.sln /rebuild
What is the C# version (visual studio 2008) of this trick?
Go to the Build tab in Project Properties
On the command line, csc /define:MYDIRECTIVE
The following command lists you the options of the C# compiler
csc.exe /?
The respective option is
/define:<symbol list> Define conditional compilation symbol(s) (Short form: /d)
However, for command-line building a C# project you might prefer MSBuild. With MSBuild, it is probably easiest to create a configuration using Visual Studio's Configuration Manager that already defines appropriate conditional compilation symbols. You can then select one of the configurations from the MSBuild command line:
MSBuild MySolution.sln /t:Rebuild /p:Configuration=ReleaseWithMyDirective