Maui
Maui copied to clipboard
[BUG] CS9057 when building with Visual Studio LTSC
Is there an existing issue for this?
- [X] I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- [X] I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
CSC : error CS9057: The analyzer assembly 'C:\Users\ContainerUser.nuget\packages\communitytoolkit.maui\8.0.1\analyzers\dotnet\cs\CommunityToolkit.Maui.Analyzers.dll' references version '4.9.0.0' of the compiler, which is newer than the currently running version '4.8.0.0'.
Expected Behavior
Build succeeds
Steps To Reproduce
Build a project referencing CommunityToolkit.Maui with an LTSC release of Visual Studio (e.g. 17.8)
Link to public reproduction project repository
NA
Environment
- .NET MAUI CommunityToolkit: 8.0.1
- OS: Windows
- .NET MAUI: 8.0.20
Anything else?
Can the Microsoft.CodeAnalysis.CSharp reference be set to an LTSC equivalent version (i.e. 4.8.0) or is there something the project requires from 4.9.2?
Add global.json file to ensure you use .net 8. I had the same issue after installing .net 9
@VladislavAntonyuk Thanks, I do already have a global.json specifying dotnet 8 allowing to roll forwards the latest minor release. So it works locally when rolling forwards, but it fails in CI where the toolchain might be older.
I had the same issue. Updating to the latest version of .NET 8 solved it.