Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XamlCompiler error WMC1006: Cannot resolve Assembly or Windows Metadata file 'Microsoft.Win32.Registry.dll'

Tags:

winapi

uwp

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.

like image 437
Briefkasten Avatar asked Oct 19 '17 11:10

Briefkasten


2 Answers

I was struggling with the same issue earlier and just managed to fix it by removing the .vs folder from the solution folder.

enter image description here

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.

like image 61
Justin XL Avatar answered Sep 20 '22 04:09

Justin XL


There is a known issue in VS2017 Ver. 15.6 related to how NuGet restores packages using FallBackFolders. You can workaround this issue by running restore with the following command:

msbuild.exe /t:Restore /p:RestoreAdditionalProjectFallbackFolders=""

You also can run he above command in your solution path or for a specific project (See following command template) or add them to your build batch file if you are using such a file to build your solution (for example on a Build Server):

msbuild.exe /t:Restore /p:RestoreAdditionalProjectFallbackFolders="" "[Your Project|Solution Path]\[Your Project|Solution Name].csproj|sln"

For more information please check the following lead: MS Developer Community

like image 29
amirfg Avatar answered Sep 21 '22 04:09

amirfg