aspnet / RoslynCodeDomProvider

Roslyn CodeDOM provider
MIT License
84 stars 43 forks source link

4.1.0-preview1 This package may not be fully compatible with your project. #145

Closed yuessir closed 2 years ago

yuessir commented 2 years ago

Package 'Microsoft.CodeDom.Providers.DotNetCompilerPlatform 4.1.0-preview1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8, .NETFramework,Version=v4.8.1' instead of the project target framework 'net6.0'. This package may not be fully compatible with your project.

my project is base on .Net 6. any problem with this?

WolfgangHG commented 2 years ago

To my understanding, "Microsoft.CodeDom.Providers.DotNetCompilerPlatform" is not compatible to .NET6. The reason is simple: it relies on "vbc.exe" and "csc.exe" to do the compilation. As this exe does not exist in the roslyn packages for .NET6, this package cannot be made compatible to .NET6.

So, to do an "on the fly compilation" in your own project, you would have to use Roslyn directly. I followed this post https://weblog.west-wind.com/posts/2022/Jun/07/Runtime-CSharp-Code-Compilation-Revisited-for-Roslyn when I converted our project to .NET6.