error MSB3073: copy /d "C:\LOANAPP\UX\UserControls\*.css" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\CSS"" exited with code 1

v2can picture v2can · Jun 19, 2011 · Viewed 18.5k times · Source

We get this error in a project in a web application solution which has VSS as source control. The project has a script in the pre-build event command line in the VS 2005 Project property page - Build event is as below :

copy /d "$(SolutionDir)UX\UserControls\*.ascx" "$(SolutionDir)UX\GetQuotations\ThirdPartyOperator\UserControls"
copy /d "$(SolutionDir)UX\UserControls\*.master" "$(SolutionDir)UX\GetQuotations\ThirdPartyOperator\UserControls"
copy /d "$(SolutionDir)UX\UserControls\*.js" "$(SolutionDir)UX\GetQuotations\ThirdPartyOperator\Javascript"
copy /d "$(SolutionDir)UX\UserControls\*.css" "$(SolutionDir)UX\GetQuotations\ThirdPartyOperator\CSS"

gives this below error:

=============================================================

C:\LOANAPP\UX\UserControls\dhtmlwindow.css
C:\LOANAPP\UX\UserControls\modal.css
        2 file(s) copied.
C:\LOANAPP\UX\UserControls\dhtmlwindow.css
**Access is denied.**
C:\LOANAPP\UX\UserControls\modal.css
**Access is denied.**
        0 file(s) copied.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(823,9): error MSB3073: copy /d "C:\LOANAPP\UX\UserControls\*.ascx" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\UserControls"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(823,9): error MSB3073: copy /d "C:\LOANAPP\UX\UserControls\*.ascx" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\UserControls"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(823,9): error MSB3073: copy /d "C:\LOANAPP\UX\UserControls\*.master" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\UserControls"
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(823,9): error MSB3073: copy /d "C:\LOANAPP\UX\UserControls\*.js" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\Javascript"
**C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(823,9): error MSB3073: copy /d "C:\LOANAPP\UX\UserControls\*.css" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\CSS" exited with code 1.**

Because of this error we have whole solution build failing.

Could anyone help us out, so that we would be able to proceed with...

Answer

MarcC picture MarcC · Nov 3, 2011

I am currently encountering the same problem.

Deleting the Release/Debug build directory prior to building you solution solves the issue for one build. When rebuilding it after that, this has to be done again though...

I'll post a real solution when I find one...

Edit: After investigating the problem some more, I found out that the problem in my solution occured because the copy command in my post-build step resulted in questions about whether or not to overwrite existing files. This somehow generates this problem.

The solution for me was to add the '/y'option to the copy/xcopy command you execute so these overwrite questions won't be asked.