Questions tagged [msbuild]

Microsoft Build Engine, also known as MSBuild, is a build platform for managed code and was part of .NET Framework.

MSBuild is a build tool that helps automate the process of creating a software product, including compiling the source code, packaging, testing, deployment and creating documentations. With MSBuild, it is possible to build Visual Studio projects and solutions without the Visual Studio IDE installed. MSBuild is available at no cost. MSBuild was previously bundled with .NET Framework; starting with Visual Studio 2013, however, it is bundled with Visual Studio instead. MSBuild is a functional replacement for the nmake utility, the latter of which remains in use in projects that originated in older Visual Studio releases.

MSBuild acts on MSBuild project files which have a similar XML syntax to Apache Ant or NAnt. Even though the syntax is based upon well-defined XML schema, the fundamental structure and operation is comparable to the traditional Unix make utility: the user specifies what will be used (typically source code files) and what the result should be (typically an application), but the utility itself decides what to do and the order in which to do it.

MSBuild can build a project against a supported .NET Framework version of choice. This feature is called "multitargeting". Any given build of a project, however, can only target one version of the framework at a time.

FAQ

Resources

14915 questions
586
votes
8 answers

Compile Views in ASP.NET MVC

I want an msbuild task to compile the views so I can see if there are compile time errors at well... compile time. Any ideas?
John Oxley
  • 14,698
  • 18
  • 53
  • 78
465
votes
24 answers

Microsoft.WebApplication.targets was not found, on the build server. What's your solution?

Trying to build my project on the build server gives me the following error: Microsoft (R) Build Engine Version 4.0.30319.1 error MSB4019: The imported project "C:\Program Files…
stacker
  • 14,641
  • 17
  • 46
  • 74
438
votes
16 answers

Resolving MSB3247 - Found conflicts between different versions of the same dependent assembly

A .NET 3.5 solution ended up with this warning when compiling with msbuild. Sometimes NDepend might help out but in this case it didn't give any further details. Like Bob I ended up having to resort to opening each assembly in ILDASM until I found…
David Gardiner
  • 16,892
  • 20
  • 80
  • 117
429
votes
22 answers

Found conflicts between different versions of the same dependent assembly that could not be resolved

When I clean and then build my solution that has several projects, the output window reports that the build succeeded. However, when I view the Error List Window, it shows me this warning: Found conflicts between different versions of the same…
Water Cooler v2
  • 32,724
  • 54
  • 166
  • 336
422
votes
23 answers

This project references NuGet package(s) that are missing on this computer

I have an ASP.NET MVC5 application that worked yesterday and now I am getting this error when I try to build: This project references NuGet package(s) that are missing on this computer. I have the two options checked that allow nuget to…
Austin Harris
  • 5,150
  • 6
  • 26
  • 39
298
votes
20 answers

MSBuild doesn't copy references (DLL files) if using project dependencies in solution

I have four projects in my Visual Studio solution (everyone targeting .NET 3.5) - for my problem only these two are important: MyBaseProject <- this class library references a third-party DLL file (elmah.dll) MyWebProject1 <- this web application…
toebens
  • 4,039
  • 6
  • 24
  • 31
232
votes
12 answers

How to Publish Web with msbuild?

Visual Studio 2010 has a Publish command that allows you to publish your Web Application Project to a file system location. I'd like to do this on my TeamCity build server, so I need to do it with the solution runner or msbuild. I tried using the…
jrummell
  • 42,637
  • 17
  • 112
  • 171
225
votes
28 answers

How do you get the current project directory from C# code when creating a custom MSBuild task?

Instead of running an external program with its path hardcoded, I would like to get the current Project Dir. I'm calling an external program using a process in the custom task. How would I do that? AppDomain.CurrentDomain.BaseDirectory just gives me…
sean
  • 11,164
  • 8
  • 48
  • 56
219
votes
2 answers

How can I install the VS2017 version of msbuild on a build server without installing the IDE?

Historically, this has been done with the Microsoft Build Tools. But it seems that the Build Tools may not be available for versions after 2015. The replacement appears to be the Visual Studio build tools, which doesn't seem to have a real homepage…
217
votes
23 answers

Path to MSBuild

How can I programatically get the path to MSBuild from a machine where my .exe is running? I can get the .NET version from the Environment but is there a way of getting the correct folder for a .NET version?
dagda1
  • 26,856
  • 59
  • 237
  • 450
200
votes
9 answers

How do I run msbuild from the command line using Windows SDK 7.1?

I'm setting up .NET 4.0 support on our CI server. I've installed .NET 4.0, and the .NET tools from the Windows 7.1 SDK. On .NET 2.0 and 3.5, that just worked. With .NET 4, when I run the "Windows SDK 7.1 Command Prompt" from the Start menu, it…
Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
199
votes
14 answers

Displaying build times in Visual Studio

Our build server is taking too long to build one of our C++ projects. It uses Visual Studio 2008, running devenv.com MyApp.sln /Build -- see devenv command-line switches (although that's for a newer version of VS). Is there a way to get devenv.com…
Roger Lipscombe
  • 89,048
  • 55
  • 235
  • 380
199
votes
33 answers

The CodeDom provider type "Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider" could not be located

It's a WebApi project using VS2015. Step to reproduce: Create an empty WebApi project Change Build output path from "bin\" to "bin\Debug\" Run Everything is working perfectly until I changed Build Output path from "bin\" to "bin\Debug\" In…
cscmh99
  • 2,701
  • 2
  • 15
  • 18
196
votes
8 answers

How do I specify the platform for MSBuild?

I am trying to use MSBuild to build a solution with a specified target platform (I need both binaries, x86 and x64). This is how I tried it: C:\WINDOWS\Microsoft.NET\Framework\v3.5>MsBuild SolutionPath\Solution.sln /t:Rebuild…
David Božjak
  • 16,887
  • 18
  • 67
  • 98
192
votes
8 answers

Link to all Visual Studio $ variables

I was having a look at $(Configuration),$(ProjectDir) etc. in Visual Studio 2008 for Prebuild events. Is there a link to all of these variables with a definition for each one of them?
chugh97
  • 9,602
  • 25
  • 89
  • 136
1
2 3
99 100