In Visual Studio my project builds without any problem, but from command line I get the error "Hard error". Project .net (c#)
Command line:
psinfo = new ProcessStartInfo(DEVENVPATH, @"""c:\Projects\[--pathtoproject--].sln"" /build");
psinfo.WindowStyle = ProcessWindowStyle.Hidden;
psinfo.UseShellExecute = false;
Process.Start(psinfo).WaitForExit();
I got error "Hard error" and Visual Studio crashed.
You should use the MSBuild.exe or csc.exe instead of devenv.exe.
const string COMPILER = "PATH/TO/DEV/TOOLS/msbuild.exe";
// later in code
psinfo = new ProcessStartInfo(COMPILER, "PATH\TO\PROJECT\PROJECT_NAME.sln /t:Rebuild /p:Configuration=Release");
Compiling with devenv requires more parameters ( and i think it requires to add some informations about projects ):
psinfo = new ProcessStartInfo(DEVENVPATH, @"""c:\Projects\[--pathtoproject--].sln"" /build RELEASE");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With