Microsoft.Common.CurrentVersion.targets(1232, 5): [MSB3971] The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
Can not build and run tests because of error
Microsoft.Common.CurrentVersion.targets(1232, 5): [MSB3971] The reference assemblies for ".NETFramework,Version=v6.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
dotnet version is 6.0.400, installed with ./dotnet-install.sh
everything is OK with dotnet 6.0.203, installed with ./dotnet-install.sh
CC @wli3 @dsplaisted
Are you change the TargetFramework on your projects (csproj files)?
<TargetFramework>net6.0</TargetFramework>
Follow the tutorial: https://docs.microsoft.com/es-es/aspnet/core/migration/31-to-60?view=aspnetcore-6.0&tabs=visual-studio
BTW you can also run dotnet --info to see what runtimes and SDKs you ahi available @ivmazurenko
We ran into the same issue after removing any prior sdk and VS (2019) and installing a fresh VS 2022. We cannot even run a basic console application now!
output of dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.400
Commit: 7771abd614
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.5
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.400/
global.json file:
Not found
Host:
Version: 6.0.8
Architecture: arm64
Commit: 55fb7ef977
.NET SDKs installed:
6.0.303 [/usr/local/share/dotnet/sdk]
6.0.400 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
.NET (and .NET Core) - introduction and overview
Learn about .NET (and .NET Core). .NET is a free, open-source development platform for building many kinds of apps.
What error do you get @rbakhshi? And building from command line or VS4M? With what you have you won't be able to target anything but .NET 6.
Going back to original post -> there is no .NETFramework,Version=v6.0.
Framework stops at 4.8.1, netcoreapp covers 2-5 and starting with 6.0 the target should be net6.0
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
Getting the same build error with a fresh install of VS for Mac.
/Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets(5,5):
Error MSB3971: The reference assemblies for ".NETFramework,Version=v6.0" were not found.
You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. (MSB3971)
.csproj file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>WMS.AnalyticReports</RootNamespace>
<LangVersion>9.0</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
<PackageReference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication" Version="2.4.1" />
<PackageReference Include="Microsoft.Azure.ApplicationInsights" Version="0.9.0-preview" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="4.0.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="Extensions\" />
</ItemGroup>
</Project>
About VS Studio Output:
Visual Studio Community 2022 for Mac
Version 17.3.5 (build 0)
Installation UUID: bc728968-7b98-461d-b1ca-e2f98238d3e6
Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64
Roslyn (Language Service)
4.3.0-3.22312.2+52adfb8b2dc71ed4278debcf13960f2116868608
NuGet
Version: 6.2.1.2
.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/6.0.401/Sdks
SDK Version: 6.0.401
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET SDK (x64)
SDK Version: 3.1.423
.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 6.0.9
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Version: 3.1.29
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Apple Developer Tools
Xcode 13.3 (20102)
Build 13E113
Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
Xamarin.iOS
Xamarin.iOS not installed.
Can't find mtouch or the Version file at /Library/Frameworks/Xamarin.iOS.framework/Versions/Current.
Xamarin Designer
Version: 17.3.0.208
Hash: 0de472ea0
Branch: remotes/origin/d17-3
Build date: 2022-09-09 03:49:29 UTC
Xamarin.Android
Version: 13.0.0.0 (Visual Studio Community)
Commit: xamarin-android/d17-3/030cd63
Android SDK: /Users/rholden/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.0 (API level 31)
11.0 (API level 30)
10.0 (API level 29)
9.0 (API level 28)
SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0
Build Information:
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6
Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Android SDK Manager
Version: 17.3.0.23
Hash: 965bf40
Branch: remotes/origin/d17-3
Build date: 2022-09-09 03:49:37 UTC
Android Device Manager
Version: 0.0.0.1169
Hash: fafb1d5
Branch: fafb1d5
Build date: 2022-09-09 03:49:37 UTC
Build Information
Release ID: 1703050000
Git revision: ff0de72f31c7c2eccb19854fbaf050fa3f713a7c
Build date: 2022-09-09 03:47:01+00
Build branch: release-17.3
Build lane: release-17.3
Operating System
Mac OS X 12.6.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
Mon Aug 22 20:20:05 PDT 2022
root:xnu-8020.140.49~2/RELEASE_ARM64_T8101 arm64
dotnet --info output:
.NET SDK (reflecting any global.json):
Version: 6.0.401
Commit: 0906eae6f8
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.6
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.401/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: arm64
Commit: 163a63591c
.NET SDKs installed:
6.0.401 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
@ryanholden8 It looks like for Arm64 you have the 6.0.401 SDK, but for x64 you only have version 3.1.423. Probably VS for Mac is using the x64 SDK which is too old to build .NET 6.
Probably you need to install a 6.0 version of the x64 SDK.
@dsplaisted - Appreciate the quick response and suggestion! Unfortunately, I'm getting the same error.
I uninstalled 3.1.423 SDK and installed x64 SDK. (Although I'm using the Apple Silicon version of VS)
About VS Studio Output:
Visual Studio Community 2022 for Mac
Version 17.3.5 (build 0)
Installation UUID: ab738806-7886-4507-852b-107f1b709ab2
Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64
Roslyn (Language Service)
4.3.0-3.22312.2+52adfb8b2dc71ed4278debcf13960f2116868608
NuGet
Version: 6.2.1.2
.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/6.0.401/Sdks
SDK Version: 6.0.401
MSBuild SDKs: /Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Sdks
.NET SDK (x64)
SDK Version: 6.0.401
.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 6.0.9
.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Version: 6.0.9
Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater
Version: 11
Apple Developer Tools
Xcode 13.3 (20102)
Build 13E113
Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
Xamarin.iOS
Xamarin.iOS not installed.
Can't find mtouch or the Version file at /Library/Frameworks/Xamarin.iOS.framework/Versions/Current.
Xamarin Designer
Version: 17.3.0.208
Hash: 0de472ea0
Branch: remotes/origin/d17-3
Build date: 2022-09-09 03:49:29 UTC
Xamarin.Android
Version: 13.0.0.0 (Visual Studio Community)
Commit: xamarin-android/d17-3/030cd63
Android SDK: /Users/rholden/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.0 (API level 31)
11.0 (API level 30)
10.0 (API level 29)
9.0 (API level 28)
SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0
Build Information:
Mono: dffa5ab
Java.Interop: xamarin/java.interop/d17-3@7716ae53
SQLite: xamarin/sqlite/3.38.5@df4deab
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@14076a6
Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
Android SDK Manager
Version: 17.3.0.23
Hash: 965bf40
Branch: remotes/origin/d17-3
Build date: 2022-09-09 03:49:37 UTC
Android Device Manager
Version: 0.0.0.1169
Hash: fafb1d5
Branch: fafb1d5
Build date: 2022-09-09 03:49:37 UTC
Build Information
Release ID: 1703050000
Git revision: ff0de72f31c7c2eccb19854fbaf050fa3f713a7c
Build date: 2022-09-09 03:47:01+00
Build branch: release-17.3
Build lane: release-17.3
Operating System
Mac OS X 12.6.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
Mon Aug 22 20:20:05 PDT 2022
root:xnu-8020.140.49~2/RELEASE_ARM64_T8101 arm64
dotnet --info output:
.NET SDK (reflecting any global.json):
Version: 6.0.401
Commit: 0906eae6f8
Runtime Environment:
OS Name: Mac OS X
OS Version: 12.6
OS Platform: Darwin
RID: osx.12-arm64
Base Path: /usr/local/share/dotnet/sdk/6.0.401/
global.json file:
Not found
Host:
Version: 6.0.9
Architecture: arm64
Commit: 163a63591c
.NET SDKs installed:
6.0.401 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Download .NET:
https://aka.ms/dotnet-download
Learn about .NET Runtimes and SDKs:
https://aka.ms/dotnet/runtimes-sdk-info
@mrward @emaf This looks like it may be an issue with VS for Mac and possibly the SDK resolver. Can you investigate / route appropriately?
@ryanholden8 Does the solution contain any classic (non SDK style projects)? Or SDK style projects that target .NET Framework v4?
From the error message you supplied VS Mac is using MSBuild on mono which does not support .NET 6.0.401 so downgrades the SDK to a version supported by MSBuild on mono.
/Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets
You can try disabling MSBuild on mono support by right clicking the solution in the Solution window, select Properties, then Build - General, and uncheck Build with MSBuild on mono.
Another workaround would be to install .NET 6.0.105 SDK - https://dotnet.microsoft.com/en-us/download/dotnet/6.0 - which should be supported by MSBuild on mono.
Visual Studio for Mac 17.3.0.5 works OK with .NET 6.0.401 and can restore/build a .NET 6 project.
This issue is stale because there has been no response to a request for more information for 7 days.
This issue was closed because there was no response to a request for more information for 10 days.
Thank you @mrward for your comments. Unchecking MSBuild on mono in the solution did in fact fix this issue. Strangely it did not edit the solution file so it seems something everyone on the team needs to configure manually.
@ryanholden8 The setting is stored in a file .vs/YourSolutionName/xs/UserPrefs.xml not in the solution, so yes, unfortunately it would need to be set manually.
The original idea behind the setting was to prevent classic Xamarin.Forms projects from failing to build, since they have a .NET Standard sdk style project, and classic Xamarin projects, and newer .NET SDKs changed how the reference assemblies worked so you would get build errors.
However, I wonder if this should be off by default instead, since it seems to be causing less obvious problems than a ref assembly setting. Maybe it would be better to default to off if there are any .NET 6 or later projects in the solution.
The main problem is that Visual Studio for Mac has to run the builds with MSBuild on mono and also dotnet's msbuild, depending on the mix of project types in the solution. Classic Xamarin projects cannot be compiled with dotnet's msbuild.
I have the same issue with .net 7. We're using a private build agent on mac for iOS builds, so I have no option to uncheck an option in vs for mac. Is there also a workaround we can implement in the pipeline?
@PaulVrugt - Not exactly sure how VS Win and build agents work here. I suspect there only workaround is to use either a separate solution or solution filter (slnf) to avoid mixing classic Xamarin projects with projects that target .NET 7.
It is not possible for dotnet msbuild to build classic Xamarin projects, and similarly, MSBuild on mono cannot build .NET 7 projects. VS Mac tries to bridge these two worlds by supporting both MSBuild on mono and dotnet msbuild.