Search code examples
c#visual-studio-2010devenv

Specifying additional conditional compilation symbols via devenv for a C# solution


I'm trying to pass an additional conditional compilation symbol via devenv (vs2010) on the command line to the C# compiler.

I know it can be done for the C++ compiler through the CL environment variables. Is there something similar possible for C#?

Since this build pass needs to run Code Analysis, I'm stuck with using devenv to launch the build, as far as I know.


Solution

  • You can't specify any compilation symbols via the command line to devenv.exe but you can create a separate solution configuration and refer to it in the command line:

    devenv.exe SolutionName /build SolnConfigName