Drew Noakes Drew Noakes - 1 year ago 427
C# Question

Perform Roslyn conditional compilation with custom symbol (eg: "DEBUG") defined

I'm compiling a project using Roslyn with code resembling:

var workspace = MSBuildWorkspace.Create();
var project = await workspace.OpenProjectAsync("SomeProject.csproj");
var compilation = await project.GetCompilationAsync();

I need to set a compilation symbol (such as
, but in my case something altogether custom). How can I do this with the API?

I saw that
has a
property, but I didn't see anything relevant there.

EDIT Thanks to @JoshVarty who pointed towards adding code like this prior to compilation:

project = project

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download