简体   繁体   English

在Visual Studio 2013中发布具有代码1错误的事件生成退出

[英]Post event build exit with code 1 error in Visual studio 2013

Here is the script: 这是脚本:

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

The error is 错误是

Error 306 The command "copy /y "C:\\dev\\blah\\Libs\\Detect.dll" "C:\\dev\\blah\\Debug" call editbin.exe /LARGEADDRESSAWARE SER.EXE > post.txt call dumpbin.exe /HEADERS SER.EXE > post1.txt" exited with code 1. 错误306命令“复制/ y“ C:\\ dev \\ blah \\ Libs \\ Detect.dll”“ C:\\ dev \\ blah \\ Debug”调用editbin.exe / LARGEADDRESSAWARE SER.EXE> post.txt调用dumpbin.exe / HEADERS SER.EXE> post1.txt“退出,代码为1。

Post event build exit with code 1 error in Visual studio 2013 在Visual Studio 2013中发布具有代码1错误的事件生成退出

Only one thing needs to be confirmed: Is this SER.EXE executed only in the release mode or just this SER.EXE is exist in the release folder and should be executed in the debug and release mode? 仅需要确认一件事:该SER.EXE仅在发布模式下执行,还是该SER.EXE在发布文件夹中存在,应该在调试和发布模式下执行?

If this SER.EXE only need to be executed in the release , Lex`s suggestion should to be considered. 如果仅在发行版中执行此SER.EXE ,则应考虑Lex的建议。 Pre- and Post-Build Events run as a batch script. 构建前和构建后事件作为批处理脚本运行。 You can do a conditional statement on $(ConfigurationName). 您可以在$(ConfigurationName)上执行条件语句。 For example: 例如:

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

If this SER.EXE is exist in the release folder and should be executed in the debug and release mode , you just need to specify the release folder in the command: 如果此SER.EXE存在于发行文件夹中,并且应在调试和发行模式下执行,则只需在命令中指定发行文件夹:

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

Obviously, you also need make sure the SER.EXE can be executed, you can use below command to test in the console application project: 显然,您还需要确保可以执行SER.EXE ,可以在控制台应用程序项目中使用以下命令进行测试:

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

Note: When you want use this post-build event in both debug and release mode, you should add the command line for all configuration, Otherwise this command will only act on one mode (Just a reminder): 注意:如果要在调试和发布模式下都使用此生成后事件,则应为所有配置添加命令行,否则此命令将仅在一种模式下起作用(仅提醒):

在此处输入图片说明

Hope this help. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM