AArnott / CodeGeneration.Roslyn

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

Question : buildMultiTargeting #43

Closed bhugot closed 7 years ago

bhugot commented 7 years ago

Hi,

why are you using a dotnet tools and not buildMultiTargeting http://www.natemcmaster.com/blog/2017/07/05/msbuild-task-in-nuget/

Thanks

AArnott commented 7 years ago

A prior version of CG.R took that exact approach. But because MSBuild itself shares a directory with Roslyn, too often Roslyn assemblies would load from that directory instead of from my MSBuild Task's directory, leading to runtime failures because of assembly version mismatches. That was just one side. I tried very hard to defend against that with AppDomains hosted by my task, etc., but no solution reliably worked on every platform -- except the approach of getting totally into my own process, which dotnet offered the quickest way to do that in a xplat way.

bhugot commented 7 years ago

Ok thanks for information.

bhugot commented 7 years ago

Another question how do it working with Old csproj. as you can't add the DotNetCliToolReference Include="dotnet-codegen"

AArnott commented 7 years ago

The current version of CG.R requires the DotNetCliToolReference item. If you can't update to a compatible project, you can use the 0.3.x releases which did not share this requirement.