如何修复构建后事件中的 MSB3073 错误? [英] How do I fix MSB3073 error in my post-build event?

查看:94
本文介绍了如何修复构建后事件中的 MSB3073 错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个项目,该项目需要将通过构建我的解决方案生成的 DLL 从 bin 文件夹复制到另一个文件夹,这两个文件夹都在我的机器上,在我的 C 驱动器中.我编写了一个使用 xcopy 来完成此操作的批处理文件,您可以在此处查看:

I'm working on a project that requires that DLLs generated by building my solution to be copied from the bin folder to another folder, both of which are on my machine, in my C drive. I've written a batch file that uses xcopy to accomplish this, which you can see here:

xcopy /s /y /q "C:UsersscoganDocumentsVisual Studio 2012ProjectsOrganizrServerinDebugOrganizr.Services.dll" "C:inetpubwwwrootAppServerin"
xcopy /s /y /q "C:UsersscoganDocumentsVisual Studio 2012ProjectsOrganizrServerinDebugOrganizr.Services.pdb" "C:inetpubwwwrootAppServerin"

现在,我已经对该文件进行了多次迭代,该文件位于:

Now, I've tried numerous iterations of this file, which is located at:

C:UsersscoganDesktopCopyFiles.bat

所以我的构建后事件命令行如下所示:

so my post-build event command line looks like this:

call C:UsersscoganDesktopCopyFiles.bat

我已经在桌面上的文件夹中单独运行了这个批处理文件,其中包含两个文本文件,它运行良好.我也使用我需要自己复制的文件来运行它,而且效果也很好.但是,当我尝试将其作为构建后事件运行时,我得到以下输出:

I've run this batch file on its own with two text files in folders on my desktop, and it works fine. I've also run it as it is with the files I need to copy on its own, and that works fine, too. However, when I try to run this as a post-build event, I get this output:

1>  Organizr -> C:UsersscoganDocumentsVisual Studio 2012ProjectsOrganizrClientinDebugOrganizr.exe
1>  File not found - Organizr.Services.dll
1>  0 File(s) copied
1>  0 File(s) copied
1>  File not found - Organizr.Services.pdb
1>c:WindowsMicrosoft.NETFrameworkv4.0.30319Microsoft.Common.targets(4291,5): error MSB3073: The command "call C:UsersscoganDesktopCopyFiles.bat" exited with code 4.

我做了一些研究,发现错误代码4表示发生初始化错误.没有足够的内存或磁盘空间,或者您在命令行输入了无效的驱动器名称或无效的语法."

I've done some research, and found that error code 4 means that "Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line."

我还查找了 MSB3073 是什么,并没有真正找到可以帮助我的东西.所以,我的问题是我做错了什么?绝对路径是否搞砸了?感谢您提供任何帮助.

I've also looked up what MSB3073 is, and haven't really found much that can help me there. So, my question is what am I doing wrong? Are the absolute paths messing it up? Any help here is appreciated.

推荐答案

玩弄不同的项目属性,我发现项目构建顺序是问题所在.生成我要复制的文件的项目是第二构建的,但是作为构建后事件运行批处理文件的项目是首先构建的,所以我只是而是将构建事件附加到第二个项目,它工作得很好.不过,谢谢大家的帮助.

Playing around with different project properties, I found that the project build order was the problem. The project that generated the files I wanted to copy was built second, but the project that was running the batch file as a post-build event was built first, so I simply attached the build event to the second project instead, and it works just fine. Thanks for your help, everyone, though.

这篇关于如何修复构建后事件中的 MSB3073 错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆