1

I have some source code I'd like to compile using the Microsoft.CSharp.CSharpCodeProvider class, and I want to include stuff that's specific to debug builds (e.g., methods marked with the [Condtional("DEBUG")] attribute).

I tried setting the CompilerParameters.CompilerOptions property to "/debug", but when I ran the compiled code the debug stuff didn't seem to be included; so I suspect that wasn't the correct way to accomplish what I want.

How can I do this?

1 Answer 1

7

You should be able to set CompilerOptions to /d:DEBUG which will define the DEBUG preprocessor symbol. That's what conditional compilation is based on, rather than the /debug flag - the latter controls whether debug information is emitted.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.