Maui icon indicating copy to clipboard operation
Maui copied to clipboard

[BUG] CS9057 when building with Visual Studio LTSC

Open jeremy-visionaid opened this issue 10 months ago • 3 comments

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?

jeremy-visionaid avatar Apr 11 '24 00:04 jeremy-visionaid

Add global.json file to ensure you use .net 8. I had the same issue after installing .net 9

VladislavAntonyuk avatar Apr 24 '24 07:04 VladislavAntonyuk

@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.

jeremy-visionaid avatar Apr 24 '24 09:04 jeremy-visionaid

I had the same issue. Updating to the latest version of .NET 8 solved it.

riccardominato avatar May 03 '24 15:05 riccardominato