4

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? enter image description here

EDIT

Project references

EDIT2

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

project compiles with Phone 8.1 and 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?!

spiderman
  • 1,565
  • 2
  • 16
  • 37
  • for Q1 . http://stackoverflow.com/questions/10113532/how-do-i-fix-the-visual-studio-compile-error-mismatch-between-processor-archit – Amit Kumar Ghosh Nov 23 '15 at 07:51
  • Please see ["Should questions include “tags” in their titles?"](http://meta.stackexchange.com/questions/19190/should-questions-include-tags-in-their-titles), where the consensus is "no, they should not"! –  Nov 24 '15 at 07:28

1 Answers1

0

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

enter image description here


enter image description here


enter image description here

daniele3004
  • 13,072
  • 12
  • 67
  • 75
  • In my project the References tab is empty... (it suggest to use Object browser ... but for what?) Please see my edit – spiderman Nov 23 '15 at 08:12
  • I have tried to maually add the Linq reference from C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 but nothing changes – spiderman Nov 23 '15 at 08:19
  • No... I have been busy, sorry... The problem is that I have created a new project (for investingating this issue). And the problem appear when I choose NET 4.0 and Phone 8.1 – spiderman Nov 23 '15 at 12:21
  • If I target NET 4.0.3 the project compiles fine! (But for backward compatibility reason I can't change the targeting) Where is VS2015 picking up the NET 4.0 and Phone 8.1 references...??? – spiderman Nov 23 '15 at 12:23
  • I use VS 2013 PRO, when I create the PortableClassLibrary I can choose the framework version. If i choose 4.0 my project run. – daniele3004 Nov 23 '15 at 12:53