问题
I upgraded my UWP Project to Fall Creator Update with the Windows SDK 10.1.16299.15.
When I compile or create a Store Package I get:
C:\Users...\Visual Studio 2017\Projects\FileRenamer\Get.the.solution.FileRenamer.App\Get.the.solution.FileRenamer.App.csproj : XamlCompiler error WMC1006: Cannot resolve Assembly or Windows Metadata file 'Microsoft.Win32.Registry.dll' 3>C:\Program Files (x86)\Windows Kits\10\bin\10.0.16299.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(263,5): Xaml Internal Error error WMC9999: Type universe cannot resolve assembly: Microsoft.Win32.Registry, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
I never referenced Microsoft.Win32.Registry.dll so I think it's Windows SDK Bug?
Where can I report such a Bug and how can I fix it?
PS: My Windows machine got the Fall Creators update and Visual Studio is up to date too.
回答1:
I was struggling with the same issue earlier and just managed to fix it by removing the .vs folder from the solution folder.
Note this folder is hidden by default, so you will need to enable showing hidden items from File Explorer.
Update
Here's a workaround from the Visual Studio Team before a proper fix comes out in the next SDK.
The Windows team investigated this issue, and like we suspected it was a known issue with the SDK that we already plan to address for the next release (we could not get this into the Fall Creators Update SDK). For now, unfortunately, you will need to make sure that the TargetPlatformMinVersion of all of the projects you have open in the same solution are identical.
回答2:
This one threw me for a bit. I was able to build fine in Visual Studio 2017 but at command-line it was failing. Apparently this had to do with my nuget.exe cli being used. It was auto-detecting VS2019 and for one reason or another that somehow invalidated 2 necessary packages for inclusion for the build which then triggered this specific question's compiler error.
I fixed it by specifying the MSBuild version via the nuget cli's options.
So instead of,
call nuget restore %Solution% -Recursive
I now do,
call nuget restore %Solution% -Recursive -MsBuildVersion 15.9
回答3:
msbuild -Restore
May help
According to my github actions enter link description here
来源:https://stackoverflow.com/questions/46828656/xamlcompiler-error-wmc1006-cannot-resolve-assembly-or-windows-metadata-file-mi