I confirmed that I can run the template app when it released at Duild.
But now, I can neither run the code I created then, nor a blank new template app.
The original version I deployed at May can run, so it's a toolset issue, not an OS issue.
What I've done from Build (May 20):
What symptoms I've met now:
WinRT.ComWrappersSupport.InitializeComWrappers
, as-if it's running unpackedI guess the first issue is caused by new Windows SDK, and the second issue is caused by new preview of .NET 5. I don't want to downgrade them to confirm this. Please consider to update the template version.
The detailed environment of my machine (You can create a new VM and confirm if the template app will fail):
Windows 10 Pro 19041
Visual Studio Enterprise 16.6.2
- .NET Desktop workload
- UWP workload, 18362 and 19041 selected
Visual Studio Community 16.7 Preview 2
- .NET Desktop workload
- UWP workload, no optional checkbox selected
- WinUI3 vsix template
.NET 5 SDK Preview 5 x64 (and also the versions come with VS)
@stevenbrix as FYI
@huoyaoyuan the issue with the latest .NET5 Preview5 is a known issue: https://github.com/microsoft/CsWinRT/issues/316
Can you elaborate a bit more on the first one? I'm surprised you need the .NET Framework SDK at all?
@stevenbrix The error was raised at Microsoft.Common.CurrentVersion.targets, L1177
Invoking Build
on the package project in VS16.7P2 raises it.
Using toolset from VS16.7 Preview raises the error, but VS16.6 toolset can build succesfully.
Here are msbuild logs:
@huoyaoyuan thanks for sharing the binlogs! It looks like there was a change to the Microsoft.DesktopBridge.targets
in VS16.7 Preview2 that broke this.
VS 16.6:
VS 16.7 Preview2:
I'll reach out to the VS folks to see if this is a known issue. I found the commit that caused this regression, and it's weird because this should affect VS16.7 Preview1 as well, but I don't think we've had issues with that?
@huoyaoyuan can you try adding this to your .wapproj and see if that fixes it for you?
<PropertyGroup>
<TargetFrameworkIdentifier>.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
</PropertyGroup>
@huoyaoyuan can you try adding this to your .wapproj and see if that fixes it for you?
@stevenbrix Yes, it fixes building of wapproj
.
@huoyaoyuan that's good to know. Do you have the .NET Framework SDK installed? VS will install that by default, so I'm wondering if maybe your install was unsuccessful?
Do you have the .NET Framework SDK installed?
The versions of .NET Framework target packs I've installed:
But, Microsoft.Common.targets
was asking for 4.5.1.
I'd expect UWP workload to ask for 4.5 because it does list 4.5 as it's dependency.
@stevenbrix Latest update:
It works with .NET 5 Preview 6 with latest CsWinRT(0.1.0-prerelease.200629.3) installed.
It still have build issue with VS 16.7P4. Your workaround is valid, but please mention the VS SDK folks.
VS bug regarding the regression is filed here: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1149356/
Closing this issue as both symptoms have been resolved
The VS issue is still present in 16.7P6. Please remember it before 16.7 is released.
@stevenbrix I have to mention you again, because this issue prevents me from building the WinUI3 desktop branch of xaml controls gallery.
It generates two errors for missing reference assemblies for .NET Framework, Version=4.5.1
and .NET Framework, Version=5.0
. Your workaround only eliminates the first one. Confirmed on VS16.7.1.
Is the fix applied in 16.8?
@huoyaoyuan i'm updating to vs16.7.2 and will let you know what i find
@huoyaoyuan I wonder if your VS config is a bit off. I was able to build with VS16.7.2.
Here is a link to my vs config
See the documentation for how to import this file: https://docs.microsoft.com/en-us/visualstudio/install/import-export-installation-configurations?view=vs-2019#import-a-configuration
This should hopefully get your VS in the correct state.
@stevenbrix I've installed a brand new instance with your config, but was still not able to build it.
To be clear, the solution I built is XamlControlGallery.Desktop.sln in winui3preview branch. Could you confirm that your configuration does work with that solution? Thanks!
Hmm I was able to build and run the desktop sln as well @huoyaoyuan
@stevenbrix I tried on my another machine, and the issue is still present.
Here is the binlog produced.
XamlControlsGallery.binlog.zip
@huoyaoyuan do you have the setting in VS to enable preview versions of .NET Core SDKs?
@stevenbrix Thanks, that solves the problem. I always use global.json
to specify preview SDK and have nearly forgotten the global switch.
@huoyaoyuan, fantastic! Yeah, I usually get different errors when I don't have this enabled, you can thank @alwu-msft for this one :)