Creating a PCL NET 4.0 gives me an error in Visual Studio 2015

删除回忆录丶 提交于 2020-01-14 10:31:50

问题


I am using VS 2015 Pro. If I create a new project Class Library (portable) Targeting: NET Framework 4.0 Windows 8

all works fine.

BUT when I add to the targeting: Windows Phone 8.1

the following two errors appear:

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.

And the Linq not found:

The type or namespace name 'Linq' does not exist in the namespace 'System' (are you missing an assembly reference?)

(PS. I am sure that everything worked fine till I let Visual Studio 2015 update some Extensions)

NOTE If I target x86 the first error goes away, but the second remains.

1) What now is happening with the Windows Phone 8 and
where Visual Studio is loading the Windows Phone 8 assemblies?

2) How can I restore the Windows Phone 8 assemblies?

EDIT

EDIT2

IMPORTANT If I change the targeting, and choose NET 4.0.3 the project compiles fine!

EDIT3 IMPORTANT I have found that it has something to do with the Framework Profiles for NET portable, that are stored at: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable

(link framework profiles

Using Package Manager Console for my project: PM> $p.Properties.Item("TargetFrameworkMoniker").Value .NETPortable,Version=v4.0,Profile=Profile328

In the folder for Profile328 I have noted that there aren't inside the .dlls but only the .xml files... What happened?! How to restore?!


回答1:


When you have the portable class library, you have this situation: In the .NET assembly there is all library if you want.

Try to delete project and create new portable class library





来源:https://stackoverflow.com/questions/33865936/creating-a-pcl-net-4-0-gives-me-an-error-in-visual-studio-2015

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!