<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0-macos</TargetFrameworks>
</PropertyGroup>
</Project>
1>C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1220,3):
error MSB4019: The imported project "C:\Program Files\dotnet\sdk\7.0.100-rc.2.22477.23\Sdks\Microsoft.NET.Sdk\12.3.1186-rc.2\targets\Xamarin.Shared.Sdk.MultiTarget.targets" was not found.
Confirm that the expression in the Import declaration ";..\12.3.1186-rc.2\targets\Xamarin.Shared.Sdk.MultiTarget.targets" is correct, and that the file exists on disk.
Environment
dotnet --version
7.0.100-rc.2.22477.23
dotnet workload list
Installed Workload Id Manifest Version Installation Source
---------------------------------------------------------------------------------------
ios 16.0.1271-rc.2-xcode14/7.0.100-rc.2 VS 17.4.33015.44
maui-android 7.0.0-rc.2.6866/7.0.100-rc.2 VS 17.4.33015.44
maui-windows 7.0.0-rc.2.6866/7.0.100-rc.2 VS 17.4.33015.44
maui-maccatalyst 7.0.0-rc.2.6866/7.0.100-rc.2 VS 17.4.33015.44
android 33.0.0-rc.2.202/7.0.100-rc.2 VS 17.4.33015.44
maccatalyst 15.4.1186-rc.2/7.0.100-rc.2 VS 17.4.33015.44
maui-ios 7.0.0-rc.2.6866/7.0.100-rc.2 VS 17.4.33015.44
Use `dotnet workload search` to find additional workloads to install.
Build Logs
[net7.0-rc2] Creating a cross-targeted library with net6.0-mac fails
[net7.0-rc2] Creating a cross-targeted library with net6.0-mac fails with an obscure error
Oct 20, 2022
Hi @jeromelaban. We have added the "need-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Here's some update.
The above message only happens when built from VS windows, not on the CLI.
Here's the binlog captured from VS: issue16400.zip and the CLI: 16400-msbuild-cli.zip
Looks like this happens when the IDE executes the _SdkGetRidsPerTargetFramework
target. It should be fairly easy to work around on our side (check if the corresponding file exists before trying to import it), but this is in a rather sensitive code path, and since it seems to be easy enough to work around (install the macOS workload), I'm going to target .NET 8 for the fix.
WinUI Android : Release build is flooded with "_x_ is generated by more than one managed type" errors
unoplatform/uno#10722
This happens with most of the visual studio templates. About the only thing that works is the WSP. The other stuff is just vaporware. For example on a fresh project with a fresh install of the latest Visual Studio 2022, when you build the multi platform solution you get:
Failed to restore C:\Users\steve\source\repos\NotitraceClient\NotitraceClient.csproj (in 3 ms).
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
1>C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1220,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\16.1.1477\targets\Xamarin.Shared.Sdk.MultiTarget.targets" was not found. Confirm that the expression in the Import declaration ";..\16.1.1477\targets\Xamarin.Shared.Sdk.MultiTarget.targets" is correct, and that the file exists on disk.
1>Done building project "NotitraceClient.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-android
1>C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore
1>Done building project "NotitraceClient.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1220,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\16.1.1477\targets\Xamarin.Shared.Sdk.MultiTarget.targets" was not found. Confirm that the expression in the Import declaration ";..\16.1.1477\targets\Xamarin.Shared.Sdk.MultiTarget.targets" is correct, and that the file exists on disk.
1>Done building project "NotitraceClient.csproj" -- FAILED.
1>C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To build this project, the following workloads must be installed: maui-tizen
1>C:\Program Files\dotnet\sdk\7.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.targets(38,5): error NETSDK1147: To install these workloads, run the following command: dotnet workload restore
1>Done building project "NotitraceClient.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
========== Elapsed 00:01.291 ==========
I am hitting this error message, even though the macos workload is installed:
Installierte Workload-ID Manifestversion Installationsquelle
-----------------------------------------------------------------------------------
android 33.0.4/7.0.100 SDK 7.0.100, VS 17.4.33213.308
ios 16.1.1477/7.0.100 SDK 7.0.100, VS 17.4.33213.308
maccatalyst 16.1.1477/7.0.100 SDK 7.0.100, VS 17.4.33213.308
macos 13.0.2032/7.0.100 SDK 7.0.100
maui-windows 7.0.52/7.0.100 VS 17.4.33213.308
maui-maccatalyst 7.0.52/7.0.100 VS 17.4.33213.308
maui-ios 7.0.52/7.0.100 VS 17.4.33213.308
maui-android 7.0.52/7.0.100 VS 17.4.33213.308
Build error:
1>C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(1226,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\7.0.102\Sdks\Microsoft.NET.Sdk\13.0.2032\targets\Xamarin.Shared.Sdk.MultiTarget.targets" was not found. Confirm that the expression in the Import declaration ";..\13.0.2032\targets\Xamarin.Shared.Sdk.MultiTarget.targets" is correct, and that the file exists on disk.
I am trying to create a new cross-platform UNO library, but hitting this bug. Any ideas? How can I work around this?
@lukasf this generally happens because VS does not install the macos workload by default (among some other unknown parts).
You can try going into the .Mobile
folder, then run dotnet workload install macos
.
Thank you. This solved my problem. It is a bit weird though, that I have to install the macos workload when it is already shown in the list of installed workloads. When running the command, I even got a warning that it is already installed, but then it started installing a whole lot of stuff and now it builds correctly.
[dotnet] Only include the Xamarin.Shared.Sdk.MultiTarget.targets file if it exists. Fixes #16400.
#17498
[release/7.0.2xx] [dotnet] Only include the Xamarin.Shared.Sdk.MultiTarget.targets file if it exists. Fixes #16400.
#17516
[dotnet] Only include the Xamarin.Shared.Sdk.MultiTarget.targets file if it exists. Fixes #16400.
rolfbjarne/xamarin-macios