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

4

6

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

Lionize answered 19/6, 2011 at 2:21 Comment(2)
Where are you calling md <DestinationFolder> prior to copy in your pre-build script? The destination directories have to exist first.Moritz
**Access is denied.**, can't be much clearer than that.Deem
F
5

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.

Fluorine answered 3/11, 2011 at 9:2 Comment(0)
M
4

If you rename the project name or change the name of the output file, change it in the post-build events and this can be solved.

Mess answered 22/11, 2012 at 6:30 Comment(0)
F
2

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

When a pre/post build command "exits with code 1", that means it failed. Just like if you said, "copy *.* f:\lolusux" and you didn't have a writable f: drive.

The solution is to fix the error.

What is the error, you say? I don't know. But I know how I'd go about figuring it out.

  1. Run the build. In the build output, copy the pre/post build commands as you did in order to paste them into your question. They will have all the macros filled in with actual values, which may be part of the issue.
  2. Paste this into Notepad. Clean all the cruft away (i.e., delete non-command text such as "error MSB3073: " and keep command text like "copy /d "C:\LOANAPP\UX\UserControls*.css" "C:\LOANAPP\UX\GetQuotations\ThirdPartyOperator\CSS")
  3. Open a command window. Browse to the output directory of the project that fails to build. That's the root directory where these commands execute.
  4. (optional for post build) disable post build commands and build the solution; this may be needed to make sure the files are in the expected state when the post build commands run.
  5. Copy each line of the pre/post build commands from notepad, paste them into the command window, and execute them. From first to last, one by one. You will see the command fail (if you did everything right, if not, go back) and get the exact error message/cause of the failure.
  6. Fix the real issue.
Floorage answered 10/2, 2015 at 14:50 Comment(0)
F
1

Just in case anyone finds that their problem isn't resolved by any of the above, I found that the error was being caused by folders in the path with spaces in their names. For instance:

MyFolder\ThirdParty Test\Blah\MoreFolders\BuildDirectory

...would fail, but

MyFolder\ThirdPartyTest\Blah...

Would work without issue. If you need to have the space in the path, surround the entire directory call in double quotes, like:

"MyFolder\ThirdParty Test\Blah\MoreFolders\BuildDirectory"

Or just the offending folder:

MyFolder\"ThirdParty Test"\Blah\MoreFolders\BuildDirectory
Fascinate answered 25/1, 2016 at 16:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.