I need to add project options (SyntaxRewriters) to be transmitted to CSharpParseOptions to be applied.
Problem is that we do not have CSharpProjectShimWithServices, nor CSharpLanguageService source code to do it (it should be in its BindToProject method).
How can I achieve that ?
I finally answer my own question.
- Into MSBuildTasks, Csc.cs
1.1. I added a public property.
1.2. I oveerrided AddResponseFileCommands to append a switch for my new property to be given to the command line compiler.
- Into CscTaskFactory.cs
2.1 In CreateTask, I split the received parameter on # character. First part is for VsSessionGuid, as before. Second part, if any, is to initialize my new Property.
- Into CompilerPackage.cs
3.1. I changed <Task Evaluate=""true"" >$(VSSessionGuid)</Task> into <Task Evaluate=""true"" >$(VSSessionGuid)#$(MyProperty)</Task>
3.2. Not all .targets file are changed this way. I had to had code at the end of initialize to change any .targets file in ImportsAfter directory to apply the same patch.
- Into CommadLineParser.cs
4.1. I added a case for my new switch.
4.2. I passed it to the CSharpParseOptions.
Now do whatever you want with this new option...