Microsoft.Build engine output of website files

779 Views Asked by At

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 (C:\output) contains a copy of all of the DLL's in the bin folder but none of the aspx pages. The "WebProjectOutputDir" directory (C:\weboutput) contains a full copy of the entire deployment package (DLL's, aspx pages, CSS etc.)

msbuild website.sln  /property:Outdir=C:\output\ /property:WebProjectOutputDir=c:\weboutput\

I attempted to re-create this command above using the following code structure:

Dictionary<string, string> globalProperties = new Dictionary<string, string>();
BuildParameters buildParameters = new BuildParameters();
buildParameters.DetailedSummary = true;

globalProperties.Add("OutDir", @"C:\output\");
globalProperties.Add("Configuration", configuration);
globalProperties.Add("WebProjectOutputDir", @"C:\weboutput\");

BuildRequestData buildRequest = new BuildRequestData(solutionFileFullPath, globalProperties, null, new string[] { "Build" }, null);
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(buildParameters, buildRequest);

When the code is executed I get a copy of all of the DLL's that make up the website in the "C:\output\" directory just like above, but the directory specified in the "WebProjectOutputDir" parameter is empty. Has anyone else used the Microsoft.Build engine to compile a website and if so, how did you get a deployable version of the code?

0

There are 0 best solutions below