dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.67k stars 1.06k forks source link

The FrameworkReference 'NETStandard.Library' was not recognized - Xamarin.Forms vs4mac #34662

Open trampster opened 1 year ago

trampster commented 1 year ago

Describe the bug

In vs4mac with a Xamarin.Forms solution with 'Build with MSBuild on mono' enabled. netstandard2.1 projects fail to build with:

/Users/hughesd/Library/Caches/VisualStudio/17.0/MSBuild/715_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(5,5): Error NETSDK1073: The FrameworkReference 'NETStandard.Library' was not recognized (NETSDK1073) (Tait.Threading)

This is affecting me on my new macbook with a fresh install, but we have other macbooks which can build this solution without problem, and our CI machine can also build it. But on my brand new MacBook pro M2 it doesn't work.

To Reproduce

Further technical details

.NET SDK: Version: 7.0.400 Commit: 73bf45718d

Runtime Environment: OS Name: Mac OS X OS Version: 13.5 OS Platform: Darwin RID: osx.13-arm64 Base Path: /usr/local/share/dotnet/sdk/7.0.400/

Host: Version: 7.0.10 Architecture: arm64 Commit: a6dbb800a4

.NET SDKs installed: 6.0.413 [/usr/local/share/dotnet/sdk] 7.0.307 [/usr/local/share/dotnet/sdk] 7.0.400 [/usr/local/share/dotnet/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.21 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found: None

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

trampster commented 1 year ago

If I change one of the projects to netstandard2.0 it will build that project, but this isn't a solution as the other projects use 2.1 features.

So for some reason my install doesn't do netstandard2.1 when built with mono, but other macs do it without problem. I checked the mono version with mono --version, and it says "Mono JIT compiler version 6.12.0.188" this is the same as whats on the mac's that work.

trampster commented 1 year ago

I found a work arround. It doesn't work because mono requires an older version of the .net SDK than is installed by vs4mac by default.

Installing .net SDK 6.0.408 makes it work. So this is a installation issue with Visual Studio for Mac which no longer supports classic Xamarin projects out of the box due to this issue.