Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
816 views
in Technique[技术] by (71.8m points)

visual studio 2012 - How do I fix MSB3073 error in my post-build event?

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.

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."

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...