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 ProjectCollection();
Dictionary<string, string> GlobalProperty = new Dictionary<string, string>();
GlobalProperty.Add("Configuration", "Release");
GlobalProperty.Add("Platform", "x86");
BuildRequestData BuidlRequest = new BuildRequestData(projectFileName, GlobalProperty, null, new string[] { "Build" }, null);
BuildResult buildResult = BuildManager.DefaultBuildManager.Build(new BuildParameters(pc), BuidlRequest);
catch (Exception e)
{
Console.Write("Error:" + e.Message);
Console.ReadLine();
}
Console.WriteLine("Completed Solution build...\nPress any key to continue...");
It doesn't thow a error, it does show Completed Solution build...
but I can't find the executable in \bin\Release
. Am I forgetting something or how can I check it?
I managed to get it working, solution is not building to due errors in the code. Anyway this is the solution.