AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

Use Csc task to create CLI arguments for Roslyn #199

Open amis92 opened 4 years ago

amis92 commented 4 years ago

See https://github.com/AArnott/CodeGeneration.Roslyn/issues/183#issuecomment-586488364

amis92 commented 4 years ago

The actual task code used would be ManagedCompiler.cs's ExecuteTool override:

https://github.com/dotnet/roslyn/blob/082d02d0616442b0370f28eecc981f8bcbec48d2/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs#L459-L470

We should pass ProvideCommandLineArgs=true and SkipCompilerExecution=true. This will result in all Roslyn CLI arguments output into CommandLineArgs item.