My Question is how to define Preprocessor Directive Global at one place for all C# classes in website.
Asked
Active
Viewed 932 times
0
-
1possible duplicate of [Preprocessor directives across different files in C#](http://stackoverflow.com/questions/13836501/preprocessor-directives-across-different-files-in-c-sharp) – axel_c Oct 16 '13 at 07:37
3 Answers
1
I am able to find similar question : Preprocessor directives across different files in C#
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>TRACE;DEBUG;LINQ</DefineConstants>
</PropertyGroup>
</Project>

Community
- 1
- 1

Dr. Rajesh Rolen
- 14,029
- 41
- 106
- 178
0
I don't think there is a way to create a global #define.
You have to create one for each project/assembly in the solution if you need all source code files to know of that #define.

Vinay Pratap Singh Bhadauria
- 9,829
- 3
- 28
- 49
0
This works for me in webconfig:
<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" />
</compilers>

Sumandeep Singh
- 35
- 1
- 1
- 8