.NET 4.0 build issues on CI server

.Net.Net 4.0MsbuildBuildContinuous Integration

.Net Problem Overview


Anybody manage to get .NET 4.0 applications compiling on a CI server without installing Visual Studio 2010 on a CI server?

No SDK exists for .NET 4.0. Have installed .NET 4.0 on CI Server. Msbuild.exe works for simple projects and give the following warning:

> (GetReferenceAssemblyPaths target) -> C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(847,9): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

.Net Solutions


Solution 1 - .Net

You don't need to install VS anymore, you can install the "Microsoft Windows SDK for Windows 7 and .NET Framework 4" now.

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b

Solution 2 - .Net

SDK for .NET 4.5 available here. Installer works well with proxy with basic authorization. Supported Operating Systems: Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2

P.S. My answer is more like a comment to Jeremy answer, but I have not enough reputation to comment on the answers.

Solution 3 - .Net

other alternative: without installing Net 4.0 SDK or vs 2010

Copy the reference assemblies folder from your dev machine to build server(190MB).

use msbuild -p:FrameworkPathOverride option to point to reference assemblies folder

the reference assemblies location:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 or C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0

found this from:

https://stackoverflow.com/questions/5876946/net-4-0-build-server-reference-assemblies-warnings-msb3644

If you get this error: "Microsoft.WebApplication.targets was not found" - just copy the target from dev machine https://stackoverflow.com/a/5344246/423356

if mvc3 is not installed in build server; "add deployable assemblies" to the mvc project http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

If you have error building the MSTest project without the sdk or visual studio installed; There are several blog post about this, to bad the solution is too complex for me. I use NUnit instead of MSTest

Solution 4 - .Net

This page lists .NET SDKs for each Visual Studio version. http://blogs.msdn.com/b/dotnet/p/dotnet_sdks.aspx

For a smaller download choose the 'developer pack' or 'targeting pack' rather than the full Windows SDK.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDMcKennaView Question on Stackoverflow
Solution 1 - .NetJeremyWeirView Answer on Stackoverflow
Solution 2 - .NetresnyanskiyView Answer on Stackoverflow
Solution 3 - .NetkiteView Answer on Stackoverflow
Solution 4 - .NetColonel PanicView Answer on Stackoverflow