문제

I have the following in a prebuild event:

copy /y $(ProjectDir)ThirdPartyAssemblies\ $(TargetDir)

Which results in the following error:

The command "copy /y C:\Users\myusername\Documents\Visual Studio 2010\Projects\mysolution\myproject\ThirdPartyAssemblies* C:\Users\myusername\Documents\Visual Studio 2010\Projects\mysolution\myproject\bin\Debug\" exited with code 1.

I've tried it in a post build event too and get the same error. Yet when I run the command it results in (the one in the error) in a console window it works fine. What am I doing wrong?

도움이 되었습니까?

해결책

I'm not sure if it's related to the error you're receiving, but you need to place quotes around your path/file names since there are spaces in them.

copy /y "C:\Users\myusername\Documents\Visual Studio 2010\Projects\mysolution\myproject\ThirdPartyAssemblies*" "C:\Users\myusername\Documents\Visual Studio 2010\Projects\mysolution\myproject\bin\Debug\"

다른 팁

copy /y "$(SolutionDir)MyProject\myFile.xxx" "$(TargetDir)" did not work for me. I pulled my hair out for 45 minutes until I stumbled across this page and then tried:

xcopy /y "$(SolutionDir)MyProject\myFile.xxx" "$(TargetDir)" 

Also, you can do it by macros. In Post/Pre Build Event Command Line, expand macros.

copy  "$(TargetPath)" "$(SolutionDir)MyProject\Bin\Debug\";

Check the path you have written inside command prompt, it can not found file or folder.

In my case I changed the solution configuration from release to debug on each project and it solved the problem.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top