Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Portable Class Library Project in build server fails

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:

  • Windows Server 2008 R2 Standard
  • TeamCity 8.0.4
  • .NET 4.5
  • Portable Class Library Tools (as advised here)
  • Silverlight 5 SDK

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.

like image 898
Arthur Nunes Avatar asked Dec 11 '13 11:12

Arthur Nunes


2 Answers

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:

  • 4.6 (June 2014):
like image 178
Radu Simionescu Avatar answered Sep 21 '22 20:09

Radu Simionescu


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
like image 36
Arthur Nunes Avatar answered Sep 19 '22 20:09

Arthur Nunes