How to build .NET 4.6 Framework app without Visual Studio installed?
Asked Answered
G

1

67

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.

Gunpowder answered 18/8, 2015 at 10:57 Comment(0)
B
108

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:

Bisson answered 18/8, 2015 at 11:0 Comment(9)
After installing the above packeges I still getting error MSB4019. Hopefully I could solve it by #19718781Gunpowder
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.Bisson
@jessehouwig: And did you also installed Windows SDK because of x64 sgen as described here or do you build x86 app only? #13373797Gunpowder
I usually just install Visual Studio on my build servers :).Bisson
For me, build done successfully after installing .Net Framework and Build tools. The targeting pack was not necessary.Irvine
The new 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.Tailband
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.Gristede
Reinstalling "Microsoft Build Tools 2015" solved the problem. Some home it was installed but MSBuild.exe was missing... Required for Jenkins builds.Maitund
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.Manse

© 2022 - 2024 — McMap. All rights reserved.