You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I create a .NET 8 WinUI Class library, and then reference that in a .NET 9 MAUI project, I get the following build error:
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(266,5): error NETSDK1005: Assets file 'E:\source\WinUIClassLibraryNet8\WinUIClassLibraryNet8\obj\project.assets.json' doesn't have a target for 'net9.0-windows10.0.19041.0'. Ensure that restore has run and that you have included 'net9.0-windows10.0.19041.0' in the TargetFrameworks for your project.
To Reproduce
Create a WinUI .NET 8 Class Library
Create a .NET MAUI .NET 9 Class Library
Add a project reference to the NET8 WinUI project from the NET9 MAUI project <ProjectReference Include="..\WinUIClassLibraryNet8\WinUIClassLibraryNet8.csproj" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
Build the project and observe the build error mentioned above.
project.assets.json' doesn't have a target for 'net9.0-windows10.0.19041.0'. Ensure that restore has run and that you have included 'net9.0-windows10.0.19041.0' in the TargetFrameworks for your project.
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version: VS2022 17.12.3
Workarounds:
Add the following to the project reference: <AdditionalProperties>TargetFramework=net8.0-windows10.0.19041.0</AdditionalProperties>
or change the WinUI class library to use TargetFrameworks instead of TargetFramework which seem silly when there's just one TFM.
The text was updated successfully, but these errors were encountered:
The proximate cause is that the GetMrtPackagingOutputs Target from the Microsoft.WindowsAppSDK package ends up calling the ResolvePackageAssets Target on the .NET 8-targeted project, but using the .NET 9 TFM from the MAUI app. It feels like there should be a negotiation step that should happen somewhere. Here's the binlog showing this. @dsplaisted / @rainersigwald do we have any guidance that we could give to the WindowsAppSDK team to help negotiate better TFMs?
I'm not sure how GetMrtPackagingOutputs should work, but probably it should hook into the existing ProjectReference handling or follow a similar pattern.
Describe the bug
If I create a .NET 8 WinUI Class library, and then reference that in a .NET 9 MAUI project, I get the following build error:
To Reproduce
<ProjectReference Include="..\WinUIClassLibraryNet8\WinUIClassLibraryNet8.csproj" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
Repro project: WinUIClassLibraryNet8.zip
Exceptions (if any)
project.assets.json' doesn't have a target for 'net9.0-windows10.0.19041.0'. Ensure that restore has run and that you have included 'net9.0-windows10.0.19041.0' in the TargetFrameworks for your project.
Further technical details
dotnet --info
.NET SDK:
Version: 9.0.101
Commit: eedb237
Workload version: 9.0.100-manifests.4a280210
MSBuild version: 17.12.12+1cce77968
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.101\
.NET workloads installed:
[ios]
Installation Source: VS 17.12.35527.113
Manifest Version: 18.1.9163/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.1.9163\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 17.12.35527.113
Manifest Version: 9.0.0/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 17.12.35527.113
Manifest Version: 35.0.7/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json
Install Type: Msi
[maccatalyst]
Installation Source: VS 17.12.35527.113
Manifest Version: 18.1.9163/9.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.1.9163\WorkloadManifest.json
Install Type: Msi
Configured to use loose manifests when installing new manifests.
Host:
Version: 9.0.0
Architecture: x64
Commit: 9d5a6a9aa4
.NET SDKs installed:
8.0.404 [C:\Program Files\dotnet\sdk]
9.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Workarounds:
Add the following to the project reference:
<AdditionalProperties>TargetFramework=net8.0-windows10.0.19041.0</AdditionalProperties>
or change the WinUI class library to use
TargetFrameworks
instead ofTargetFramework
which seem silly when there's just one TFM.The text was updated successfully, but these errors were encountered: