Question: The trusty old preprocessor directive in C# appear to work great when I write:

```
#if DEBUG
...
(Some code)
...
#endif

```

However, attributes enclosed in the conditional block appear to continue to get processed and I get errors indicating such. For instance, surrounding an `[AssemblyVersion(...)]` within the conditional block appears to have no affect.

I can go into the details as to why we want to conditionally ignore the [AssemblyVersion(..)], but it's irrelevant. Any ideas?

Answer: 
I figured it out! There was a key piece of information I neglected to mention: that it was a Workflow project (Guid {14822709-B5A1-4724-98CA-57A101D1B079}). It turns out that there is a bug with the workflow project type, specifically the Workflow.Targets file that is included in the build file.

It appears that the preprocessor acts as though the DEBUG constant is defined. You can repro the issue by creating a workflow project and adding this to the AssemblyInfo file:

```
#if DEBUG
[assembly: AssemblyFileVersion("1.0.0.0")]
#endif

```

Then try a release build.
I filed this with MS: <https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=466440>

Best regards!
-Sean
simpler - you can tag your debug function(s) with the metadata tag [Conditional]:

```
#define DEBUG1

...

public static void PrintText1(string txt)   {
    Console.Write("This is PrintText2\n");
}

[Conditional("DEBUG1")]
public static void PrintText2(string txt)   {
    Console.Write("This is PrintText2\n");
}

[STAThread]
static void Main(string[] args)    {
    PrintText1("This is the unconditional method");
    PrintText2("This function will be called only if 'DEBUG1' is defined");
}

```

try it!

Also, what I noticed is that `#define` only exists within the context of the file it is defined, ex calling PrintText2 from another file, where debug is not defined, will not execute. This also works the other way around:

```
[Conditional("DEBUG1")]
public static void ConditionedPrint(string txt) {
    Console.Write("This is PrintText2\n");
}

public static void UnconditionedPrint(string txt)     {
    ConditionedFunc(txt);
}

```

UnconditionedFunc will print "This is PrintText2\n" iff (if and only if) #define DEBUG1 was defined in *this* file, regardless of the other files.

There is also System.Diagnostics.Debug, I'm not sure what it does though.