Click here to Skip to main content
16,016,157 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.My Question is how to define Preprocessor Directive Global at one place for all C# classes in website.
Posted

It is defined as a command-line argument of a compiler. As you can see from the C# compiler CSC.EXE documentation, you can use the command-line argument /define:
http://msdn.microsoft.com/en-us/library/vstudio/0feaad6z.aspx[^],
http://msdn.microsoft.com/en-us/library/vstudio/78f4aasd.aspx[^].

In the MSBuild projects, this is defined in a property group, per Configuration and Platform properties, in
HTML
<DefineConstants>TRACE;DEBUG;SomeCustomConditionalCompilationSymbol</DefineConstants>


The GUI front-end interface to this feature depends on particular IDE. In Visual Studio, this is done on the project Properties page, the tab "Build", int the field "Conditional Compilation Symbols".

—SA
 
Share this answer
 
This works for me in webconfig:
XML
<system.codedom>
<compilers>
  <compiler>
    language="c#;cs;csharp" extension=".cs"
    compilerOptions="/d:custompreprocessor"
    type="Microsoft.CSharp.CSharpCodeProvider, 
    System, Version=2.0.0.0, Culture=neutral, 
    PublicKeyToken=b77a5c561934e089" />
</compiler></compilers></system.codedom>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900