Search code examples
winapiuwp

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


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.


Solution

  • 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.