Is it possible to modify source code before compilation using Roslyn within MSBuild task on CI server? I’ve succeeded to do what I want in VS but I wonder if it is possible outside VS. Currently I’m looking at Workspace APIs and Compiler APIs and they seem to be the right tool to achieve that, but I’m still not sure is it possible at all? In particular I’m concerned about returning changes that I’ve done to MSBuild back to allow it to continue its job.
Is it possible to modify source code before compilation using Roslyn within MSBuild task
Share
This is definitely a scenario that we are thinking of. Today there are a couple of problems that make it a bit difficult:
In the future, we’d like to provide a “Create a workspace from a csc/vbc command line string”, which would make this a lot easier.
Take a look at Hooking into the compiler (csc.exe or vbc.exe) itself and Problem with using Roslyn in a MS Build Task for some previous discussion on this.