66

Until now, I could build .NET 4.5.2 using command line

c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild MySolution.sln

The only what I need to install on a computer was .NET Framework and Visual Studio 2010 shell.

Now I consider upgrading to .NET 4.6., but I cannot find a way how to build a solution without Visual Studio.

I don't want to install Visual Studio 2015, because it is too big for this hosted virtual machine. I hope some MSBuild or Microsoft package installation could be sufficient.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148

1 Answers1

106

Install:

Then call a different version of MsBuild to build your solution:

 C:\Program Files (x86)\MSBuild\14.0\Bin\MsBuild.exe MySolution.sln

Note, this may not contain all bits pieces and sdk's that ship with Visual Studio, so you may encounter "missing .targets files" or other problems building your application. Other SDKs may alleviate that problem:

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • After installing the above packeges I still getting error MSB4019. Hopefully I could solve it by http://stackoverflow.com/questions/19718281/external-vs2013-build-error-error-msb4019-the-imported-project-path-was-not – Tomas Kubes Aug 18 '15 at 13:29
  • 1
    What kind of error are you getting? You may need additional SDK's to be installed, depending on what kind of app you're trying to build. Try building a simple Console App that does Hello World, that should work now. – jessehouwing Aug 18 '15 at 13:30
  • @jessehouwig: And did you also installed Windows SDK because of x64 sgen as described here or do you build x86 app only? http://stackoverflow.com/questions/13373297/sgen-an-attempt-was-made-to-load-an-assembly-with-an-incorrect-format – Tomas Kubes Aug 18 '15 at 14:22
  • 6
    I usually just install Visual Studio on my build servers :). – jessehouwing Aug 18 '15 at 14:46
  • 1
    For me, build done successfully after installing .Net Framework and Build tools. The targeting pack was not necessary. – Hossein Dec 15 '16 at 12:53
  • 1
    The new [Build Tools for Visual Studio 2017 RC](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017-rc) are making this requirement a thing of the past: if you can migrate your code to Visual Studio 2017 you will be able to use them. – Giulio Vian Feb 17 '17 at 18:14
  • This helped me to discover that the new project in my solution is using a higher framework's version of the rest of the projects that references it, and that why I got build/compile errors. – Jaider Mar 16 '17 at 15:26
  • 1
    Reinstalling "Microsoft Build Tools 2015" solved the problem. Some home it was installed but MSBuild.exe was missing... Required for Jenkins builds. – Drasius Apr 13 '17 at 12:28
  • This worked until I came across a project that needs the SdkToolsPath. It keeps looking in the registry under the NETFXSDK\4.6 key. I installed the 4.6.2 developer kit but that doesn't set the 4.6 key. I try passing SdkToolsPath as a property to MSbuild but that doesn't work either. How should I approach this? I can't figure out where to download the 4.6 SDK. – Christopher Painter Jul 18 '17 at 20:31