2

I'm having trouble getting a .NET 7.0 MAUI project to simply build from Visual Studio for Mac version 17.4.3. The message it gives me indicates that an old .NET SDK is being used to target .NET 7.0:

/Applications/Visual Studio.app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets(5,5): Error MSB3971: The reference assemblies for ".NETFramework,Version=v7.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) (DataModel.Common)

But my expectation is that the latest installed version will always be used unless overriden by global.json. Here is the output of dotnet --info:

.NET SDK:
 Version:   7.0.200-preview.22628.1
 Commit:    76bbaffad6

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.2
 OS Platform: Darwin
 RID:         osx.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/7.0.200-preview.22628.1/

Host:
  Version:      7.0.2
  Architecture: x64
  Commit:       d037e070eb

.NET SDKs installed:
  6.0.405 [/usr/local/share/dotnet/sdk]
  7.0.102 [/usr/local/share/dotnet/sdk]
  7.0.200-preview.22628.1 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.32 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.32 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.17 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.2 [/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

The project in question DataModel.Common is the first project encountered by the compiler and does not do anything fancy with .NET SDK versions either:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <LangVersion>latest</LangVersion>
    <Configurations>Debug;Release;Test</Configurations>
  </PropertyGroup>

Here as well is the build output with Log verbosity: Diagnostic

Building MYAPP.Maui (Debug)
Build started 1/30/2023 1:41:45 PM.
Environment at start of build:
MSBUILDPROJECTROOTELEMENTCACHESIZE = 200
ServiceHubLogSessionKey        = 91F98E44
DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR = /usr/local/share/dotnet
__CF_USER_TEXT_ENCODING        = 0x1F5:0x0:0x0
USER                           = myuser
PKG_CONFIG_PATH                = /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/pkgconfig
XPC_FLAGS                      = 0x0
MONO_GC_PARAMS                 = nursery-size=64m
LD_LIBRARY_PATH                = /Library/Frameworks/Mono.framework/Versions/6.12.0/lib:
TMPDIR                         = /var/folders/3n/s_99kk3x6p5654z53jq8tbsr0000gn/T/
XCODE_DEVELOPER_DIR_PATH       = 
COMPlus_EnableCrashReport      = 1
COMPlus_DbgEnableMiniDump      = 0
XBUILD_FRAMEWORK_FOLDERS_PATH  = 
DISPLAY                        = /private/tmp/com.apple.launchd.UbqOG3rTnn/org.macosforge.xquartz:0
COMPlus_DbgEnableFastHeapDumps = 1
XPC_SERVICE_NAME               = application.com.microsoft.visual-studio-preview.184456257.184456797
HOME                           = /Users/myuser
MONO_PATH                      = 
COMMAND_MODE                   = unix2003
__CFBundleIdentifier           = com.microsoft.visual-studio-preview
PATH                           = /Library/Frameworks/Mono.framework/Commands:/Applications/Visual Studio (Preview).app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/usr/local/bin:~/.dotnet/tools:/usr/local/share/dotnet
PKG_CONFIG_LIBDIR              = 
MSBUILD_EXE_PATH               = /Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/MonoDevelop.MSBuildBuilder.exe
DYLD_BIND_AT_LAUNCH            = 1
SSH_AUTH_SOCK                  = /private/tmp/com.apple.launchd.vcMjUlwHTK/Listeners
SHELL                          = /bin/zsh
ServiceHubUniqueLogDir         = vsmac
MONO_GAC_PREFIX                = 
COMPlus_EnableDumpOnSigTerm    = 1
GTKSHARP_SLIM_STARTUP          = yes
LOGNAME                        = myuser

__________________________________________________
Project "/Users/myuser/git/myapp/datamodel.common/DataModel.Common.csproj" (Build target(s)):

Building with tools version "Current".
Target "_CheckForUnsupportedTargetFramework" skipped, due to false condition; ('$(_UnsupportedTargetFrameworkError)' == 'true') was evaluated as ('' == 'true').
Target "_CollectTargetFrameworkForTelemetry" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets":
  Using "Telemetry" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "Telemetry"
  Done executing task "Telemetry".
Done building target "_CollectTargetFrameworkForTelemetry" in project "DataModel.Common.csproj".
Target "_CheckForUnsupportedNETCoreVersion" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(NETCoreAppMaximumVersion)' != '') was evaluated as ('.NETFramework' == '.NETCoreApp' And '5.0' != '').
Target "_CheckForUnsupportedCppNETCoreVersion" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets":
  Task "NETSdkError" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(_TargetFrameworkVersionWithoutV)' < '3.1' and '$(Language)' == 'C++') was evaluated as ('.NETFramework' == '.NETCoreApp' and '7.0' < '3.1' and 'C#' == 'C++').
Done building target "_CheckForUnsupportedCppNETCoreVersion" in project "DataModel.Common.csproj".
Target "_CheckForUnsupportedNETStandardVersion" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETStandard' And '$(NETStandardMaximumVersion)' != '') was evaluated as ('.NETFramework' == '.NETStandard' And '' != '').
Target "_CheckForUnsupportedTargetFrameworkAndFeatureCombination" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets":
  Task "NETSdkError" skipped, due to false condition; ('$(UsingNETSdkDefaults)' != 'true') was evaluated as ('true' != 'true').
Done building target "_CheckForUnsupportedTargetFrameworkAndFeatureCombination" in project "DataModel.Common.csproj".
Target "_CheckForUnsupportedAppHostUsage" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(HasRuntimeOutput)' == 'true') was evaluated as ('.NETFramework' == '.NETCoreApp' and '' == 'true').
Target "_CheckForMismatchingPlatform" skipped, due to false condition; ('$(RuntimeIdentifier)' != '' and '$(PlatformTarget)' != '') was evaluated as ('' != '' and '' != '').
Target "_CheckForLanguageAndFeatureCombinationSupport" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets":
  Task "NETSdkError" skipped, due to false condition; ('$(Language)' == 'C++' and $(OutputType) != 'library' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp') was evaluated as ('C#' == 'C++' and Library != 'library' and '.NETFramework' == '.NETCoreApp').
  Task "NETSdkError" skipped, due to false condition; ('$(Language)' == 'C++' and $(EnableComHosting) == 'true') was evaluated as ('C#' == 'C++' and  == 'true').
  Task "NETSdkError" skipped, due to false condition; ('$(Language)' == 'C++' and $(SelfContained) == 'true') was evaluated as ('C#' == 'C++' and  == 'true').
Done building target "_CheckForLanguageAndFeatureCombinationSupport" in project "DataModel.Common.csproj".
Target "_CheckForNETCoreSdkIsPreview" skipped, due to false condition; ( '$(_NETCoreSdkIsPreview)' == 'true' AND '$(SuppressNETCoreSdkPreviewMessage)' != 'true' ) was evaluated as ( 'false' == 'true' AND '' != 'true' ).
Target "_GetProjectJsonPath" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/NuGet.targets":
  Task "GetRestoreProjectJsonPathTask" skipped, due to false condition; ( '$(RestoreProjectStyle)' == 'ProjectJson' OR '$(RestoreProjectStyle)' == '' ) was evaluated as ( 'PackageReference' == 'ProjectJson' OR 'PackageReference' == '' ).
Done building target "_GetProjectJsonPath" in project "DataModel.Common.csproj".
Target "_CheckForUnsupportedNETCoreVersion" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(NETCoreAppMaximumVersion)' != '') was evaluated as ('.NETFramework' == '.NETCoreApp' And '5.0' != '').
Target "_CheckForUnsupportedNETStandardVersion" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETStandard' And '$(NETStandardMaximumVersion)' != '') was evaluated as ('.NETFramework' == '.NETStandard' And '' != '').
Target "UpdateAspNetToFrameworkReference" skipped, due to false condition; ('$(TargetFrameworkIdentifier)' == '.NETCoreApp' And '$(_TargetFrameworkVersionWithoutV)' >= '3.0') was evaluated as ('.NETFramework' == '.NETCoreApp' And '7.0' >= '3.0').
Target "CheckForImplicitPackageReferenceOverrides" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets":
  Using "CheckForImplicitPackageReferenceOverrides" task from assembly "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/../tools/net472/Microsoft.NET.Build.Tasks.dll".
  Task "CheckForImplicitPackageReferenceOverrides"
  Done executing task "CheckForImplicitPackageReferenceOverrides".
Done building target "CheckForImplicitPackageReferenceOverrides" in project "DataModel.Common.csproj".
Target "ApplyImplicitVersions" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets":
  Using "ApplyImplicitVersions" task from assembly "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/../tools/net472/Microsoft.NET.Build.Tasks.dll".
  Task "ApplyImplicitVersions"
  Done executing task "ApplyImplicitVersions".
Done building target "ApplyImplicitVersions" in project "DataModel.Common.csproj".
Target "CheckForImplicitPackageReferenceOverrides" skipped. Previously built successfully.
Target "ProcessFrameworkReferences" skipped, due to false condition; ('@(FrameworkReference)' != '') was evaluated as ('' != '').
Target "_CheckForObsoleteDotNetCliToolReferences" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ObsoleteReferences.targets":
  Task "NETSdkWarning" skipped, due to false condition; ( '%(_ReferenceToObsoleteDotNetCliTool.Identity)' != '' ) was evaluated as ( '' != '' ).
Done building target "_CheckForObsoleteDotNetCliToolReferences" in project "DataModel.Common.csproj".
Target "CollectPackageReferences" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/NuGet.targets":
  Using "CheckForDuplicateNuGetItemsTask" task from assembly "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/NuGet.Build.Tasks.dll".
  Task "CheckForDuplicateNuGetItemsTask"
  Done executing task "CheckForDuplicateNuGetItemsTask".
Done building target "CollectPackageReferences" in project "DataModel.Common.csproj".
Target "_GetRestoreProjectStyle" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/NuGet.targets":
  Using "GetRestoreProjectStyleTask" task from assembly "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/NuGet.Build.Tasks.dll".
  Task "GetRestoreProjectStyleTask"
    (in) HasPackageReferenceItems 'True'
    (in) MSBuildProjectDirectory '/Users/myuser/git/myapp/datamodel.common'
    (in) MSBuildProjectName 'DataModel.Common'
    (in) ProjectJsonPath ''
    (in) RestoreProjectStyle 'PackageReference'
    (out) IsPackageReferenceCompatibleProjectStyle 'True'
    (out) ProjectStyle 'PackageReference'
  Done executing task "GetRestoreProjectStyleTask".
Done building target "_GetRestoreProjectStyle" in project "DataModel.Common.csproj".
Target "EnableIntermediateOutputPathMismatchWarning" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/NuGet.targets":
Done building target "EnableIntermediateOutputPathMismatchWarning" in project "DataModel.Common.csproj".
Target "ApplyImplicitVersions" skipped. Previously built successfully.
Target "WarnForExplicitVersions" skipped, due to false condition; ('@(SdkBuildWarning)' != '') was evaluated as ('' != '').
Target "CheckForImplicitPackageReferenceOverrides" skipped. Previously built successfully.
Target "CheckForDuplicateItems" in file "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.DefaultItems.targets":
  Using "CheckForDuplicateItems" task from assembly "/Users/myuser/Library/Caches/VisualStudio/17.0/MSBuild/63726_3/Sdks/Microsoft.NET.Sdk/targets/../tools/net472/Microsoft.NET.Build.Tasks.dll".
  Task "CheckForDuplicateItems"
  Done executing task "CheckForDuplicateItems".
  Task "CheckForDuplicateItems"
  Done executing task "CheckForDuplicateItems".
  Task "CheckForDuplicateItems"
  Done executing task "CheckForDuplicateItems".
Done building target "CheckForDuplicateItems" in project "DataModel.Common.csproj".
Target "CheckWindowsDesktopSdkInUse" skipped, due to false condition; ('$(UseWpf)' == 'true' Or '$(UseWindowsForms)' == 'true') was evaluated as ('' == 'true' Or '' == 'true').
Target "ProcessFrameworkReferences" skipped, due to false condition; ('@(FrameworkReference)' != '') was evaluated as ('' != '').
Target "_CheckForInvalidConfigurationAndPlatform" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
  Task "Error" skipped, due to false condition; ( '$(_InvalidConfigurationError)' == 'true' ) was evaluated as ( '' == 'true' ).
  Task "Warning" skipped, due to false condition; ( '$(_InvalidConfigurationWarning)' == 'true' ) was evaluated as ( '' == 'true' ).
  Using "Message" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "Message"
    Configuration=Debug
  Done executing task "Message".
  Task "Message"
    Platform=AnyCPU
  Done executing task "Message".
  Task "Error" skipped, due to false condition; ('$(OutDir)' != '' and !HasTrailingSlash('$(OutDir)')) was evaluated as ('bin/Debug/net7.0/' != '' and !HasTrailingSlash('bin/Debug/net7.0/')).
  Task "Error" skipped, due to false condition; ('$(IntermediateOutputPath)' != '' and !HasTrailingSlash('$(IntermediateOutputPath)')) was evaluated as ('obj/Debug/net7.0/' != '' and !HasTrailingSlash('obj/Debug/net7.0/')).
  Task "Error" skipped, due to false condition; ('$(BaseIntermediateOutputPath)' != '' and !HasTrailingSlash('$(BaseIntermediateOutputPath)')) was evaluated as ('obj/' != '' and !HasTrailingSlash('obj/')).
  Task "Error" skipped, due to false condition; ( '$(_InitialMSBuildProjectExtensionsPath)' != '' And '$(MSBuildProjectExtensionsPath)' != '$(_InitialMSBuildProjectExtensionsPath)' ) was evaluated as ( '/Users/myuser/git/myapp/datamodel.common/obj/' != '' And '/Users/myuser/git/myapp/datamodel.common/obj/' != '/Users/myuser/git/myapp/datamodel.common/obj/' ).
  Task "Warning" skipped, due to false condition; ( '$(EnableBaseIntermediateOutputPathMismatchWarning)' == 'true' And '$(_InitialBaseIntermediateOutputPath)' != '$(BaseIntermediateOutputPath)' And '$(BaseIntermediateOutputPath)' != '$(MSBuildProjectExtensionsPath)' ) was evaluated as ( 'true' == 'true' And 'obj/' != 'obj/' And 'obj/' != '/Users/myuser/git/myapp/datamodel.common/obj/' ).
Done building target "_CheckForInvalidConfigurationAndPlatform" in project "DataModel.Common.csproj".
Target "BeforeBuild" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
Done building target "BeforeBuild" in project "DataModel.Common.csproj".
Target "_CheckForBuildWithNoBuild" skipped, due to false condition; ('$(NoBuild)' == 'true' and '$(GeneratePackageOnBuild)' != 'true') was evaluated as ('' == 'true' and 'false' != 'true').
Target "BuildOnlySettings" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
Done building target "BuildOnlySettings" in project "DataModel.Common.csproj".
Target "_CheckForUnsupportedTargetFramework" skipped, due to false condition; ('$(_UnsupportedTargetFrameworkError)' == 'true') was evaluated as ('' == 'true').
Target "GetFrameworkPaths" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.NETFramework.CurrentVersion.targets":
Done building target "GetFrameworkPaths" in project "DataModel.Common.csproj".
Target "GetFrameworkPaths" skipped. Previously built successfully.
Target "_CheckForUnsupportedTargetFramework" skipped, due to false condition; ('$(_UnsupportedTargetFrameworkError)' == 'true') was evaluated as ('' == 'true').
Target "GetReferenceAssemblyPaths" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
  Using "GetReferenceAssemblyPaths" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "GetReferenceAssemblyPaths"
    /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v7.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.
  Done executing task "GetReferenceAssemblyPaths" -- FAILED.
Done building target "GetReferenceAssemblyPaths" in project "DataModel.Common.csproj" -- FAILED.
Target "_CheckForCompileOutputs" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
Done building target "_CheckForCompileOutputs" in project "DataModel.Common.csproj".
Target "_SGenCheckForOutputs" skipped, due to false condition; ('$(_SGenGenerateSerializationAssembliesConfig)' == 'On' or ('@(WebReferenceUrl)'!='' and '$(_SGenGenerateSerializationAssembliesConfig)' == 'Auto')) was evaluated as ('Off' == 'On' or (''!='' and 'Off' == 'Auto')).
Target "_CleanGetCurrentAndPriorFileWrites" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
  Using "ReadLinesFromFile" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "ReadLinesFromFile"
  Done executing task "ReadLinesFromFile".
  Using "ConvertToAbsolutePath" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "ConvertToAbsolutePath"
  Done executing task "ConvertToAbsolutePath".
  Using "FindUnderPath" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "FindUnderPath"
    Comparison path is "/Users/myuser/git/myapp/datamodel.common".
  Done executing task "FindUnderPath".
  Task "FindUnderPath"
    Comparison path is "bin/Debug/net7.0/".
  Done executing task "FindUnderPath".
  Task "FindUnderPath"
    Comparison path is "obj/Debug/net7.0/".
  Done executing task "FindUnderPath".
  Using "RemoveDuplicates" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "RemoveDuplicates"
  Done executing task "RemoveDuplicates".
Done building target "_CleanGetCurrentAndPriorFileWrites" in project "DataModel.Common.csproj".
Target "_CleanRecordFileWrites" in file "/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets":
  Task "RemoveDuplicates"
  Done executing task "RemoveDuplicates".
  Using "MakeDir" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "MakeDir"
  Done executing task "MakeDir".
  Using "WriteLinesToFile" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
  Task "WriteLinesToFile"
  Done executing task "WriteLinesToFile".
Done building target "_CleanRecordFileWrites" in project "DataModel.Common.csproj".

Done building project "DataModel.Common.csproj" -- FAILED.

Project Performance Summary:
      877 ms  /Users/myuser/git/myapp/datamodel.common/DataModel.Common.csproj   1 calls

Target Performance Summary:
        0 ms  BuildOnlySettings                          1 calls
        0 ms  EnableIntermediateOutputPathMismatchWarning   1 calls
        0 ms  _CheckForUnsupportedCppNETCoreVersion      1 calls
        0 ms  BeforeBuild                                1 calls
        0 ms  _CheckForUnsupportedTargetFrameworkAndFeatureCombination   1 calls
        0 ms  _GetProjectJsonPath                        1 calls
        0 ms  _CheckForLanguageAndFeatureCombinationSupport   1 calls
        2 ms  _CheckForObsoleteDotNetCliToolReferences   1 calls
        4 ms  _CheckForCompileOutputs                    1 calls
        9 ms  GetFrameworkPaths                          1 calls
       12 ms  CheckForDuplicateItems                     1 calls
       15 ms  _CheckForInvalidConfigurationAndPlatform   1 calls
       17 ms  CollectPackageReferences                   1 calls
       30 ms  _CleanRecordFileWrites                     1 calls
       40 ms  _GetRestoreProjectStyle                    1 calls
       42 ms  ApplyImplicitVersions                      1 calls
       54 ms  GetReferenceAssemblyPaths                  1 calls
       88 ms  CheckForImplicitPackageReferenceOverrides   1 calls
      178 ms  _CollectTargetFrameworkForTelemetry        1 calls
      277 ms  _CleanGetCurrentAndPriorFileWrites         1 calls

Task Performance Summary:
        4 ms  ConvertToAbsolutePath                      1 calls
        5 ms  Message                                    2 calls
        6 ms  RemoveDuplicates                           2 calls
        7 ms  CheckForDuplicateItems                     3 calls
       10 ms  WriteLinesToFile                           1 calls
       10 ms  CheckForDuplicateNuGetItemsTask            1 calls
       15 ms  ApplyImplicitVersions                      1 calls
       17 ms  MakeDir                                    1 calls
       31 ms  GetRestoreProjectStyleTask                 1 calls
       39 ms  CheckForImplicitPackageReferenceOverrides   1 calls
       46 ms  Telemetry                                  1 calls
       52 ms  GetReferenceAssemblyPaths                  1 calls
       77 ms  ReadLinesFromFile                          1 calls
      184 ms  FindUnderPath                              3 calls

Build FAILED.

/Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1232,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v7.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.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:03.84

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Build: 1 error, 0 warnings

Could anyone please help me get this app running from Visual Studio for Mac?

Thank you in advance.

dythim
  • 920
  • 7
  • 24
  • Can you check if the new project you loaded was picking up a global.json file from the project directory? The global.json pointing to the old SDK will overwrite the SDK used by vs by default.You can refer to the official doc: [global.json overview](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json?tabs=netcore3x#examples) – Zack Jan 31 '23 at 02:16
  • @DongzhiWang-MSFT there isn't any global.json anywhere in the directory structure for this project. Very confused what is happening. Also uninstalled and reinstalled Visual Studio for Mac and got the same issue. – dythim Jan 31 '23 at 03:18
  • Did you try to create a new empty project and it builds fine? Are there any NuGet packages referenced in your project, and which ones? – Zack Jan 31 '23 at 09:21
  • I'm checking that now @DongzhiWang-MSFT Looks like a new VS for Mac is available too. – dythim Jan 31 '23 at 20:22
  • @DongzhiWang-MSFT: Created a new project with the .NET MAUI Blazor App template. Pressed run, got this error: MacCatalyst/Info.plist Error: The LSMinimumSystemVersion value in the Info.plist (10.15) does not match the SupportedOSPlatformVersion value (16.1) Changed LSMinimumSystemVersion to 16.1, got this error: Error: The LSMinimumSystemVersion value in the Info.plist (16.1) does not match the SupportedOSPlatformVersion value (16.1) This is... frustrating. – dythim Jan 31 '23 at 21:24
  • That is to say, you can't run a basic new project now, right? You can report your problem to VS, select Help > Report a Problem from the menu bar. – Zack Feb 01 '23 at 05:32
  • That's correct -- cannot build/run a new .NET MAUI project. I will report the problems. Thank you for your help. – dythim Feb 01 '23 at 13:26

1 Answers1

2

I got a working solution from Yoke Ou on Microsoft Developer Community:

Could you try unchecking “Build with MSBuild on Mono” (Right click Solution-> Properties - Build - General)? Hope it is useful to you!

https://developercommunity.visualstudio.com/t/Unable-to-build-NET-MAUI-project/10267533?viewtype=all

dythim
  • 920
  • 7
  • 24
  • 1
    This did not work for me on```Visual Studio Community 2022 for Mac Version 17.4.2 (build 17)``` It was already unchecked in my case. – heypran Mar 27 '23 at 16:15