I encounered this problem when I've open one of my projects for the first time on Visual Studio 2019. This was a project that I've created about three years ago and demand me just a few changes a year.
The first time I've tried to compile this project on Visual Studio 2019 I received an error related to csc.exe file, and as I've had been this error before, I've reinstaled compilers componente at Nuget Package Manager, as I did in previous times successfully.
After that, I got the error "Microsoft.Net.Compilers is only supported on MSBuild v16.3 and above".
I found out some solutions on Microsoft Developer Community recommending to open and edit the file: "packages\Microsoft.Net.Compilers.3.4.0\build\Microsoft.Net.Compilers.props", but it seens like wierd to me.
MSBuild uses csc.exe as its actual compiler but knows where to find assemblies, references etc based on your solution and project files (these files are actually xml files).
. NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps. Build Mobile, Desktop and WebAssembly apps with C# and XAML.
The . NET Compiler Platform ("Roslyn") provides open-source C# and Visual Basic compilers with rich code analysis APIs. You can build code analysis tools with the same APIs that Microsoft is using to implement Visual Studio!
It's possible to forcefully remove the package PM> Uninstall-Package Microsoft. Net. Compilers -Force (gives errors when updating Umbraco), remove the build-target from the project file (needs to be repeated after updating the package) or move code to a seperate library. This should however not be required...
EDIT: As this new answer to another question states it is unlikely that Microsoft.Net.Compilers
is necessary to have in your project. Read through that answer to make sure you actually need it at all. If you don't, removing Microsoft.Net.Compilers
should resolve your issue. If you still need its limited functionality or if you have a problem after uninstalling it, read on for the original answer:
I had this problem after upgrading to .NET framework 4.7.2, and could not upgrade to the suggested beta of Microsoft.Net.Compilers
as it didn't seem to be available.
It should be noted that Microsoft.Net.Compilers
has been deprecated and migrating to Microsoft.Net.Compilers.Toolset
is recommended.
To migrate, you can simply use Nuget to uninstall Microsoft.Net.Compilers
and install Microsoft.Net.Compilers.Toolset
.
The version number for both was the same for me, but this fixed the problem for me and I was able to build.
Upgrade nuget package Microsoft.Net.Compilers
to version 3.5.0-beta2-final
and it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With