.NET 4.0 build issues on CI server
Asked Answered
N

4

98

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.

Novanovaculite answered 28/4, 2010 at 15:16 Comment(1)
How can I make this a fatal error rather than a warning? It's hidden in our build log and instead it fails further down with some cryptic message about mscorlib.dllDykes
K
128

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

Katykatya answered 23/7, 2010 at 5:41 Comment(8)
The default install is 1.7 GB, but most of these files are unnecessary. If you un-check everything except .NET Development > Intellisense and Reference Assemblies that will still give you the .NET 4 targeting pack that you need (it's about 450 MB).Dayak
You may also want to check .NET Development > Tools as that will bring in several utilities such as sn.exe that come in handy for dealing with signed assemblies.Pikestaff
I downloaded the installer, and when I ran it, it said I had .net 4 installed already, but the Intellisense and Reference Assemblies was unchecked. Checking it, and installing those files seemed to fix the issue for me. The weird thing is, I've had this CI build working for months now, and it just started throwing this error today.Orly
this is just as big as visual studio express. So why not just install VS?Dunleavy
2 reasons spring to mind. 1. because it is free and when you have to have multiple build servers those VS licences stack up. 2. if the server is headless and has to be automated then why would you want a gui on it?Pumpkin
There is also a web installer so you only have to download the needed parts. Can be downloaded here: microsoft.com/download/en/confirmation.aspx?id=8279Recce
While this is named "for Windows 7" it is worth noting the Supported operating systems: Windows 7, Windows Server 2003 R2 Standard Edition (32-bit x86), Windows Server 2003 R2 Standard x64 Edition , Windows Server 2008, Windows Server 2008 R2, Windows Vista, Windows XP Service Pack 3Soundboard
That answer help me. I had a diffrent problem installing sdk 7.1 which solved as shown here mathworks.com/matlabcentral/answers/95039Tshombe
I
22

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.

Infidelity answered 11/10, 2012 at 6:55 Comment(2)
From the referenced page: "The Windows SDK no longer ships with a complete command-line build environment. The Windows SDK now requires a compiler and build environment to be installed separately." So I assume this is not sufficient to run a build server.Tinnitus
This fixed it for me. You only have to select the option ".NET Framework 4.5 Software Development Kit" which requires only 62.3 MB and works fine on a TFS Build 2013 server installed on Windows Server 2012 R2 for SharePoint Apps deployment. No need to override the FrameworkPathOverride parameter.Ramonramona
V
10

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:

.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://mcmap.net/q/79985/-microsoft-webapplication-targets-was-not-found-on-the-build-server-what-39-s-your-solution

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

Valuer answered 6/8, 2012 at 4:59 Comment(1)
Since my 2012 server would not let me install .Net 4 because the installer said there is a higher version. I did what @Valuer said and copied from a PC I had were VS 2012 was installed. This resolved my issues.Selfabuse
D
-1

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.

Dykes answered 4/2, 2015 at 14:27 Comment(1)
It can be a general tip to install developer pack or targeting pack, but specific to .NET Framework 4.0 (this question is all about) there is no such pack and Windows SDK is inevitable.Kleptomania

© 2022 - 2024 — McMap. All rights reserved.