Copy error during the process after assembly

I am writing an ASP.NET web application using Visual Studio 2008. The project basically does not change from the default empty project that Visual Studio provides, with the exception of:

  • In properties-> Build-> Output, the "XML documentation file" is marked and set to "bin \ MyProject.XML"
  • In properties-> assembly events "Command line of the event after assembly:" is set to copy /y "$(TargetDir)$(TargetName).XML" "C:\TEMP\"

When I create a project for the first time or rebuild, the build process completes successfully. However, if I try to build any time after this, the build process will end with this message:

 ------ Build started: Project: MyProject, Configuration: Debug Any CPU ------ MyProject -> C:\Projects\MyProject\MyProject\bin\MyProject.dll copy /y "C:\Projects\MyProject\MyProject\bin\MyProject.XML" "C:\TEMP\" The system cannot find the file specified. c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(3397,13): error MSB3073: The command "copy /y "C:\Projects\MyProject\MyProject\bin\MyProject.XML" "C:\TEMP\"" exited with code 1. Done building project "MyProject.csproj" -- FAILED. ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ========== 

I am sure that the syntax is correct because I can execute the post-build command in the command window:

 C:\>copy /y "C:\Projects\MyProject\MyProject\bin\MyProject.XML" "C:\TEMP\" 1 file(s) copied. 

The team works when I do it manually, so why does it fail when it is part of the build process?

+4
source share
1 answer

There is an error in the main msbuild tasks that Visual Studio uses when creating an XML documentation file in the same directory as the specified output path for intermediate builds.

To fix this, you need to specify a different directory, for example:

enter image description here

and change your copy command after build, accordingly:

 copy /y "C:\Projects\MyProject\MyProject\docbin\Debug\MyProject.XML" "C:\TEMP\" 
+6
source

Source: https://habr.com/ru/post/1384915/


All Articles