简体   繁体   中英

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

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!

项目编译与Phone 8.1和NET 4.0.3

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?!

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

在此输入图像描述


在此输入图像描述


在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM