Compiling at runtime with MSBuild.exe

codeamateur

New member
Joined
Apr 27, 2017
Messages
2
Programming Experience
3-5
I implemented compiling at runtime with MSBuild.exe in the following way:


C#:
using(System.Diagnostics.Process p = new System.Diagnostics.Process())
            { 
                p.StartInfo =
                    new ProcessStartInfo(@"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe");
                p.StartInfo.Arguments = @"C:\\Workspace\\Commander.V1_0.csproj" " /fl /flp:logfile="CommanderOutput.log";
               
                p.Start();
               
                p.WaitForExit();
                p.Close(); // So that the current thread close. and release all the resources.
            }

In most cases compiling works, and the resulting files Commander.V1_0.dll and Commander.V1_0.pdb are created. But, in some cases compiling fails. Then, the user must be informed about, in which folder the log file CommanderOutput.log is located. I'm going to show him a hyperlink to this folder. How I can find out this folder programmatically?
 
Back
Top Bottom