16

I've recently added some custom Portable Class Library projects to an application that is built in an build server. The build was working fine, but after that it stopped working and shows me the following messages:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(983, 5): warning MSB3644: The reference assemblies for framework ".NETPortable,Version=v4.0,Profile=Profile136" were not found.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1578, 5): warning MSB3270: 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\Framework64\v4.0.30319\mscorlib.dll", "AMD64".

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

The build server specs:

The solution is a .NET 4.0 application and the portable projects target .NET4.0+ e Silverlight 5, only. portable targets

I have checked my development machine (Windows 8, Visual Studio 2012). There is indeed a folder "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile136" (in fact, the profiles for .NET 4.0 go up to 158). In the build machine, however, there are only folders for profiles up to 131.

Is Portable Class Library Tools up to date? It seems it miss installing profiles for the most recent platforms.

UPDATE

I copied the ".NETPortable\v4.0\Profile\Profile136" of my development machine to the build server, and now the application builds successfully. I still would like to know why installing the Portable Class Library Tools does not work out of the box.

Arthur Nunes
  • 6,718
  • 7
  • 33
  • 46

3 Answers3

14

A more general and elegant solution is to install the latest Microsoft .NET Portable Library Reference Assemblies. This will install profile138 among many others.

The standalone installer(s) can be found at:

Tieson T.
  • 20,774
  • 6
  • 77
  • 92
Radu Simionescu
  • 4,518
  • 1
  • 35
  • 34
  • Yeah, I see Microsoft has released an updated installer of PCL assemblies. That was what I was looking for, but it wasn't available by the time I was setting up my build machine. – Arthur Nunes Feb 15 '14 at 14:15
  • How can we find the latest version of PCL? Does Microsoft has a page where we can find latest PCL that's install-able on build servers? – nikib3ro Apr 30 '16 at 05:53
  • @kape123 I guess that is the latest version... are you experiencing any specific issues? – Radu Simionescu May 01 '16 at 08:10
  • Yeah - installing did nothing for me - only when I copied all assemblies `C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable` from my dev machine to build server did it start working. Guess you need to pay attention to profiles in .csproj file... could be something worth adding to your answer. In any case - thanks - this question and posts helped guide me to solution. – nikib3ro May 01 '16 at 12:49
  • 6
    Please note that the installer does not actually install the files, but puts a ZIP file somewhere off the main hard drive (probably `C:\Program Files (x86)\Microsoft .NET Portable Library Reference Assemblies 4.6`). You'll have to unzip the file, and then copy it to the proper location on the server. For me, this was: `C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable`. Handy tip, to create the folder, name it like `.NETPortable.` with the period at the end - Windows will strip the ending period and allow you to create the folder. – Cody Jul 07 '16 at 18:43
  • 1
    @Cody works! But I eventually also copied it from my dev machine instead of that download. I must add: I checked more Targets: .NET 4.5, Windows 8, ASP.NET Core 1.0, Windows phone and some Xamarin things. I copied only .NETPortable and .NETCore to the build server. Here are some additional download links: https://www.microsoft.com/net/targeting – CularBytes Mar 01 '17 at 00:14
  • 1
    @Cody is the real MVP here. I've installed that damn 4.6 update a hundred times and it never put anything in that .NETPortable path. Wtf is this craziness with having to unzip into that directory? Is that even documented anywhere? – Sam Aug 16 '18 at 02:39
  • @Sam - I'm not sure. I remember it had me going crazy until I happened to find it when aimlessly clicking around in despair. I don't recall finding any documentation for it, but it's been a while. – Cody Oct 03 '18 at 23:00
4

Copying the desired profile (it is explicit in the error message) from the dev machine to the build server, after installing Portable Class Library Tools, allowed my build to work.

Apparently the Portable Class Library, as it is now, does not include the most up to date portable profiles.

If anyone knows of a more up to date way to get portable profiles on a build server, other than installing VS or copying them manually, I really would like to know.

UPDATE

Path, on my dev machine, for the folder to be copied to the server machine (the path in the server was the same):

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.0\Profile\Profile136
Arthur Nunes
  • 6,718
  • 7
  • 33
  • 46
3

Profile136 came with the version of the portable library targeting pack that was part of the Phone SDK 8.0 (or a later VS Update for VS 2012). The version of the targeting pack you were using is older.

TheESJ
  • 2,357
  • 17
  • 13
  • My dev machine has VS 2012 Update 3 and builds the app fine. As I said, my dev machine presents more portable profiles than the ones Portable Class Library Tools installs. So it seems the targeting pack my app uses is newer than the version available of Portable Class Library Tools. – Arthur Nunes Dec 11 '13 at 16:05