I have tried this code where proj\chancher2.sln
is the path to another solution file which I'm trying to build.
private void button1_Click(object sender, EventArgs e)
{
try
{
string projectFileName = @"proj\chancher2.sln";
ProjectCollection pc = new ProjectCollection();
Dictionary<string, string> GlobalProperty = new Dictionary<string, string>();
GlobalProperty.Add("Configuration", "Debug");
GlobalProperty.Add("Platform", "x86");
//Here, we set the property
GlobalProperty.Add("OutputPath", @"D:\Output");
BuildRequestData BuidlRequest = new BuildRequestData(projectFileName, GlobalProperty, null, new string[] { "Build" }, null);
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), BuidlRequest);
}
catch (Exception E) {
MessageBox.Show(E.Message);
}
}
When I click on the button I don't get any error but when I go to the Debug folder I don't find the executable compiled. Also when I go to D:\Output folder. Nothing is there.
Where is the executable file. Or Is there any errors in the code above ?
Any help would be highly appreciated