在Visual Studio 2013中发布事件构建退出,代码1错误

时间:2017-09-07 15:36:54

标签: c# .net visual-studio msbuild post-build-event

这是脚本:

copy /y "$(SolutionDir)Libs\Detect.dll" "$(SolutionDir)$(ConfigurationName)"
call editbin.exe /LARGEADDRESSAWARE SER.EXE > post.txt
call dumpbin.exe /HEADERS SER.EXE > post1.txt

错误是

  

错误306命令" copy / y" C:\ dev \ blah \ Libs \ Detect.dll"   " C:\ dev的\等等\调试"调用editbin.exe / LARGEADDRESSAWARE SER.EXE>   post.txt调用dumpbin.exe / HEADERS SER.EXE> post1.txt"退出了   代码1。

1 个答案:

答案 0 :(得分:0)

  

在Visual Studio 2013中发布代码1错误的事件构建退出

只需要确认一件事:这个SER.EXE是仅在发布模式下执行还是只有SER.EXE存在于发布文件夹中,应该在调试和发布模式下执行? / p>

如果只需要在发布中执行此SER.EXE ,则应考虑Lex的建议。构建前和构建后事件作为批处理脚本运行。您可以在$(ConfigurationName)上执行条件语句。例如:

copy /y "$(SolutionDir)Libs\Detect.dll" "$(SolutionDir)$(ConfigurationName)"
if $(ConfigurationName) == Release call editbin.exe /LARGEADDRESSAWARE "SER.EXE"> post.txt
if $(ConfigurationName) == Release call dumpbin.exe /HEADERS SER.EXE > post1.txt

如果发布文件夹中存在此SER.EXE且应在调试和发布模式下执行,则只需在命令中指定发布文件夹:

 call editbin.exe /LARGEADDRESSAWARE "Release\SER.EXE"> post.txt
 call dumpbin.exe /HEADERS "Release\SER.EXE"> post1.txt

显然,您还需要确保SER.EXE可以执行,您可以使用以下命令在控制台应用程序项目中进行测试:

call editbin.exe /LARGEADDRESSAWARE "$(TargetPath)"> post.txt

注意:如果要在调试和发布模式下使用此post-build事件,则应为所有配置添加命令行,否则此命令仅作用于一种模式(仅限a提醒):

enter image description here

希望得到这个帮助。