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

5

12

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.

Candescent answered 19/10, 2017 at 11:16 Comment(0)
S
14

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.

Studdard answered 20/10, 2017 at 3:4 Comment(3)
Also, I removed the bin and obj folders from each project and updated to the latest UniversalWindowsPlatform in nuget. I am not 100% sure but they might have helped too...Studdard
To change your TargetPlatformMinVersion go to your project properties and there should be a dropdown with all available versions.Prager
Deleting the .vs folder didn't work for, me, deleting bin and obj did.Disconsolate
I
1

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

Infundibulum answered 4/11, 2019 at 23:31 Comment(2)
Where must I execute this?Rabblerouser
CMD.exe or if you prefer PowerShell just remove call from those commands.Infundibulum
M
1

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

Mittiemittimus answered 19/2, 2020 at 9:3 Comment(0)
E
0
msbuild -Restore

May help

According to my github actions enter link description here

Exhibit answered 5/11, 2019 at 23:30 Comment(0)
E
0

Just dealt with a similar situation. I had experienced this in the past and it had to do with the version of .Net and the platform. But this time, I was using an external Library Organization.Library and my project had the name Organization.Services.Library and this was a problem to visual studio. renaming my project to Organization.Services.Libraries` solved it.

Not the best name but I know what to fix.

Entail answered 14/11, 2023 at 14:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.