UWP XamlCompiler error WMC1006 的一种场景
编译环境visual studio 2017
错误的完整描述是这样的:
XamlCompiler error WMC1006: Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.'
出现该错误应该有许多不同的场景, 如以下链接所以说的,没有正确的Microsoft>NETCore.UniversalWindowsPlatform 版本。
但是在我这个场景中,以上方法并不能解决问题, 在该错误之下下,还有一系列这样的错误
C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\XamlCompiler\Microsoft.Windows.UI.Xaml.Common.targets(580,5): error MSB3030: Could not copy the file "obj\x64\Debug\App.xbf" because it was not found.
…
我出现这个错误的场景是这样的:
添加一个基于Net-Standard 的库之后,编译时并没有错误,但是每次添加新代码时就会报这个错,去掉Net-Standard 的库之后,编译通过,再把这个有问题Net-Standard 的库添加进来,此时编译也通过,若再添加新的代码或者对工程有任何改动,编译时又会出现以上错误。
通过这个链接 https://www.songshizhao.com/blog/blogpage/525.html,说存在框架不支持的引用或者配置不正确的引用时,我才详细地查看带有黄色感叹号的Net-Standard 库
展开来来发现该库确实存在引用问题。去掉该库,问题得到解决