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

后端 未结 14 2562
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 04:48

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 m

相关标签:
14条回答
  • 2020-12-05 04:50

    In my case, the dll I was creating by building the project was still in use in the background. I killed the application and then xcopy worked fine as expected.

    0 讨论(0)
  • 2020-12-05 04:50

    The specified error is related to the post built event. Somehow VS tool is not able to copy the files to the destination folder. There can be many reasons for it. To check the exact error cause go to Tools > Option> Project and Solution > Built and run, and change "MsBuild project build output verbosity" to "Diagnostic". It will give you enough information to detect the actual problem.

    0 讨论(0)
  • 2020-12-05 04:56

    I faced this issue recently and surprisingly only i was having this problem and none of my team members were facing this issue when building the project code.

    On debugging i found that my code directory had spacing issue , It was D:\GIT Workspace\abc\xyz.

    As a quick fix i changed it to D:\GITWS\abc\xyz and it solved the problem.

    0 讨论(0)
  • 2020-12-05 04:59

    I had the same problem for my Test project. I found out why my post build event wasn't working and that's because I was copying files before running the $(ProjectName).exe command and some of these files were required for Test project itself. Hence, by just moving $(ProjectName).exe as the first command fix the issue.

    0 讨论(0)
  • 2020-12-05 05:00

    Prefer the MsBuild "Copy" task in an AfterBuild target over a post-build event.

    Append this Target into your project file and remove the PostBuildEvent.

    <Target Name="AfterBuild">
        <Copy SourceFiles="C:\Users\scogan\Documents\Visual Studio 2012\Projects\Organizr\Server\bin\Debug\Organizr.Services.*" 
              DestinationFolder="C:\inetpub\wwwroot\AppServer\bin\" 
              OverwriteReadOnlyFiles="true" 
              SkipUnchangedFiles="false" />
    </Target>
    
    0 讨论(0)
  • 2020-12-05 05:00

    For what it's worth, the problem in my case was caused by using '/' as the directory separator in a copy command. Must use backslashes.

    0 讨论(0)
提交回复
热议问题