我使用的是 VS 2015 Pro。如果我创建一个新项目类库(可移植)定位: 网络框架 4.0 window 8
一切正常。
但是当我添加到定位时: Windows Phone 8.1
出现如下两个错误:
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll", "x86". This mismatch may cause runtime failures.
并且未找到 Linq:
The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)
(PS。我确信在我让 Visual Studio 2015 更新一些扩展之前一切正常)
注意如果我以 x86 为目标,第一个错误消失,但第二个错误仍然存在。
1) Windows Phone 8 和
Visual Studio 在哪里加载 Windows Phone 8 程序集?
编辑
EDIT2
重要 如果我更改目标并选择 NET 4.0.3,项目编译正常!
EDIT3 重要 我发现它与 NET 可移植框架配置文件有关,存储在: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable
为我的项目使用包管理器控制台: PM> $p.Properties.Item("TargetFrameworkMoniker").Value .NETPortable,Version=v4.0,Profile=Profile328
在 Profile328 的文件夹中,我注意到 .dll 中没有 但只有 .xml 文件......发生了什么事?!怎么恢复?!
最佳答案
关于c# - 创建 PCL NET 4.0 在 Visual Studio 2015 中出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33865936/