NOR*_*4EL 8 c# visual-studio visual-studio-2017
在Visual Studio中,我的项目构建没有任何问题,但是从命令行我得到错误"硬错误".项目.net(c#)
命令行:
psinfo = new ProcessStartInfo(DEVENVPATH, @"""c:\Projects\[--pathtoproject--].sln"" /build");
psinfo.WindowStyle = ProcessWindowStyle.Hidden;
psinfo.UseShellExecute = false;
Process.Start(psinfo).WaitForExit();
Run Code Online (Sandbox Code Playgroud)
我收到错误"硬错误",Visual Studio崩溃了.
您应该使用MSBuild.exe或csc.exe而不是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");
Run Code Online (Sandbox Code Playgroud)
使用devenv进行编译需要更多参数(我认为它需要添加一些关于项目的信息):
psinfo = new ProcessStartInfo(DEVENVPATH, @"""c:\Projects\[--pathtoproject--].sln"" /build RELEASE");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9078 次 |
| 最近记录: |