ProjectCollection pc = new ProjectCollection();
Project proj = pc.LoadProject("myProject.csproj");
BuildParameters bp = new BuildParameters(pc); BuildRequestData buildRequest = new BuildRequestData(proj.CreateProjectInstance(), new string[] { "Build" }); BuildResult buildResult = BuildManager.DefaultBuildManager.Build(bp, buildRequest);In the above example, we create a new BuildParameters object with the ProjectCollection instance, then create a new BuildRequestData with the project instance and the "Build" target. We then use the DefaultBuildManager to build the project using the above parameters. This package library is part of the Microsoft.Build.Framework NuGet package.