Open AnnYang01 opened 1 year ago
If change the MyCsClassLibrary project and MyCSDesktopProject's Target Platform Version to below on VS 17.6.0 Preview 1.0 [33414.285.d17.6].
<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17134.0</TargetPlatformMinVersion>
Hi, can you let us know if this still repros in WinAppSDK 1.4?
@JesseCol this issue still reproes in WinAppSDK 1.4! please see the screenshot. Due to the repro project is too big to upload, you can refer to https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/24416/WinUI-BVTs?anchor=c%23-project-referencing-a-winui-3-component-library to create a repro project. this issue was closed "Not planned", did you mean "it won't be fixed in the future"?
I just hit this too, is the fix to downgrade the Microsoft.WindowsAppSDK, or is it necessary to drop the target version to .NET6?
Describe the bug
I create new C# Desktop Project and this project Reference a C# Library User Control, finally, I create a functional Windows Runtime component (WinUI 3 Component Library) following the below steps, after build this solution, CS0246 and MSB3073 error will occur.
Steps to reproduce the bug
Actual result: 5 errors and 5 warnings are in Error List. Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'ThermometerWRC' could not be found (are you missing a using directive or an assembly reference?) MyCsClassLibrary C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCsClassLibrary\UserControl1.xaml.cs 15 Active Warning MSB3851 This project targets "Windows, Version=10.0.19041.0", but it is attempting to reference "C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\Debug\ThermometerWRC\ThermometerWRC.winmd" targeting "UAP,Version=10.0.22621.0", which is invalid. MyCSDesktopProject C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 2677
Error CS0246 The type or namespace name 'Thermometer' could not be found (are you missing a using directive or an assembly reference?) MyCsClassLibrary C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCsClassLibrary\UserControl1.xaml.cs 35 Active Error CS0246 The type or namespace name 'Thermometer' could not be found (are you missing a using directive or an assembly reference?) MyCsClassLibrary C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCsClassLibrary\UserControl1.xaml.cs 35 Active Warning Could not read the Windows SDK's Platform.xml at C:\Program Files (x86)\Windows Kits\10\Platforms\UAP\10.0.19041.0\Platform.xml MyCSDesktopProject C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCSDesktopProject\EXEC 1
Warning MSB3073 The command ""C:\Users\v-annyang.FAREAST.nuget\packages\microsoft.windows.cswinrt\2.0.2\cswinrt.exe" @"C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCSDesktopProject\obj\x86\Debug\net6.0-windows10.0.19041.0\win10-x86\Generated Files\cswinrt.rsp"" exited with code 1. MyCSDesktopProject C:\Users\v-annyang.FAREAST.nuget\packages\microsoft.windows.cswinrt\2.0.2\build\Microsoft.Windows.CsWinRT.targets 191 Warning MSB3851 This project targets "Windows, Version=10.0.19041.0", but it is attempting to reference "C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\Debug\ThermometerWRC\ThermometerWRC.winmd" targeting "UAP,Version=10.0.22621.0", which is invalid. MyCsClassLibrary C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 2677
Error Could not read the Windows SDK's Platform.xml at C:\Program Files (x86)\Windows Kits\10\Platforms\UAP\10.0.19041.0\Platform.xml MyCsClassLibrary C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCsClassLibrary\EXEC 1
Error MSB3073 The command ""C:\Users\v-annyang.FAREAST.nuget\packages\microsoft.windows.cswinrt\2.0.2\cswinrt.exe" @"C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\MyCsClassLibrary\obj\Debug\net6.0-windows10.0.19041.0\Generated Files\cswinrt.rsp"" exited with code 1. MyCsClassLibrary C:\Users\v-annyang.FAREAST.nuget\packages\microsoft.windows.cswinrt\2.0.2\build\Microsoft.Windows.CsWinRT.targets 191 Warning MSB3851 This project targets "Windows, Version=10.0.19041.0", but it is attempting to reference "C:\Users\v-annyang.FAREAST\source\repos\MyCSDesktopProject\Debug\ThermometerWRC\ThermometerWRC.winmd" targeting "UAP,Version=10.0.22621.0", which is invalid. MyCSDesktopProject C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 2677
Expected behavior
No error occur.
Screenshots
NuGet package version
None
Windows version
Windows 11 (22H2): Build 22621
Additional context
This issue also reproduces on ARM64 machine.