Questions tagged [microsoft.build]

MSBuild is a Microsoft build platform typically used in conjunction with Visual Studio. MSBuild version 2.0 is part of .NET Framework 2.0 and works together with Visual Studio 2005. Version 3.5 of MSBuild, which is bundled together with .NET 3.5 (and Visual Studio 2008), allows .NET projects to be built for either 2.0, 3.0 or 3.5 .NET version support (also known as"multi-targeting").

MSBuild is a Microsoft build platform typically used in conjunction with Visual Studio. MSBuild version 2.0 is part of .NET Framework 2.0 and works together with Visual Studio 2005. Version 3.5 of MSBuild, which is bundled together with .NET 3.5 (and Visual Studio 2008), allows .NET projects to be built for either 2.0, 3.0 or 3.5 .NET version support (also known as"multi-targeting").

It is possible to build Visual Studio projects and solutions without the Visual Studio IDE installed. MSBuild is available at no cost.

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.

42 questions
2
votes
1 answer

Build Failure while using buildManager with the latest microsoft.build.dll,v12.0.0.0

I updated the assembly reference in my build tool to use the latest versions(v12) of microsoft.build,microsoft.build.engine and microsoft.build.framework. But while compiling a project using the BuildManager(I use the Rebuild option for…
Deepu
  • 23
  • 3
2
votes
1 answer

Get list of projects from Visual Studio .sln file using Microsoft.Build namespace

I figured out how to load a .csproj file using the Microsoft.Build namespace and extract a couple of properties: var projectCollection = new ProjectCollection(); projectCollection.LoadProject(@"C:\path\to\my.csproj"); string assemblyName =…
Mark Nugent
  • 599
  • 2
  • 5
  • 20
2
votes
1 answer

Building a .sln in C# executable

I'm trying to build a .sln in C#. I have the following code. try { Console.WriteLine("Building Solution...\n"); string projectFileName = Directory.GetCurrentDirectory() + "\\build\\Solution.sln"; ProjectCollection pc = new…
Alex
  • 322
  • 4
  • 18
1
vote
0 answers

How to do a ClickOnce publish programmatically?

I need to pulbish ClickOnce application using C# code (using Microsoft.Build). I've searched quite a long time without finding good know-how of the procedure. Using MAGE.EXE or publishing it from Visual Studio is not an option. Since the…
Asen Mitov
  • 37
  • 4
1
vote
1 answer

Enforce Microsoft.Build to reload the project

I'm trying to iteratively (part of automation): Create backup of the projects in solution (physical files on the filesystem) Using Microsoft.Build programmatically load and change projects inside of the solution (refernces, includes, some other…
Kiryl
  • 180
  • 13
1
vote
1 answer

Why is building with one version of MSBuild raising errors looking for assemblies from another version of MSBuild?

My codebase contains about 30 solutions. Most of the projects in these solutions are (C#) .NET Framework, but more recently I've been adding some .NET Standard 2.0 and .NET Core 3.1 projects. All projects in all solutions build perfectly fine in…
1
vote
1 answer

Get path to .NET Framework directory in Powershell

I am trying to use this method to get the .NET Framework directory (e.g. C:\Windows\Microsoft.NET\v4.0.30319) Add-Type -AssemblyName Microsoft.Build.Utilities $dotNetDir =…
prb
  • 171
  • 1
  • 2
  • 10
1
vote
0 answers

Building solutions in parallel with Microsoft.Build.Execution.BuildManager

I'm trying to build multiple solutions in parallel across different threads and it isn't working. The code looks like: var buildParameters = new BuildParameters(new ProjectCollection()) { MaxNodeCount = 1, Loggers = loggers }; var…
rcarrington
  • 1,485
  • 2
  • 12
  • 23
1
vote
1 answer

Set Configuration when using Microsoft.Build.Evaluation.Project?

I can build a project with the following static bool Build() { var projectCollection = ProjectCollection.GlobalProjectCollection; var project = projectCollection.LoadProject(websiteProject); var fileLogger = new FileLogger(); …
Craig
  • 474
  • 7
  • 21
1
vote
0 answers

Build solution with msbuild api

I have been trying to build a solution using MSbuild API since few weeks now without success. I was able to build the solution by running a batch file inside my program that execute MSBUild.exe but I noticed that this is not a really good way of…
cgadjoro
  • 127
  • 1
  • 7
1
vote
1 answer

Could not load file or assembly 'Microsoft.Build'

When I am trying to build my solution I am getting below error. I have tried installing it in GAC but still getting this error Error 2 Could not load file or assembly 'Microsoft.Build' or one of its dependencies. This assembly is built by a…
nectar
  • 9,525
  • 36
  • 78
  • 100
1
vote
1 answer

Microsoft.Build.BuildEngine ignores BeforeTargets

Building a project file with the Microsoft.Build.BuildEngine library seems to be ignoring the BeforeTargets attribute. My project file has the following target:
Tarmil
  • 11,177
  • 30
  • 35
1
vote
1 answer

Project.Build does not work with DeployOnBuild=true

My code is as follows: ... propertyGroup1.AddProperty("DeployOnBuild", "true"); propertyGroup1.AddProperty("DeployTarget", "MSDeployPublish"); propertyGroup1.AddProperty("MSDeployServiceUrl",…
1
vote
0 answers

Microsoft.Build engine output of website files

I am using the Microsoft.Build engine to compile a website from another application and I am experiencing an issue in getting the correct deployable content. If I use the following MSBuild command the website builds properly. The "Outdir" directory…
user26901
0
votes
0 answers

Unable to build C# Solution using MSBuild programmatically

i want to build a C# Solution (.sln) using MSBuild from another C# program. I am using the Microsoft.Build API, however i could not make it work so far. Please see below the code to build the solution: private void BuildSolution(string…