C++ Visual Studio Post Build 复制命令错误 MSB3073 退出代码 1

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25566834/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 11:21:23  来源:igfitidea点击:

Visual Studio Post Build copy command error MSB3073 exit code 1

c++visual-studio-2013

提问by user1883004

So I have C++ Player project which has 2 other project dependencies, both of which have post build events to copy the dll to another folder. The project was building, then it decided not to work randomly, and since then I have not found a solution. Even with a clean checkout from SVN, it still does not work, it works for all the other devs, apart from me.

所以我有 C++ Player 项目,它有 2 个其他项目依赖项,这两个项目都有后期构建事件将 dll 复制到另一个文件夹。该项目正在构建,然后它决定不随机工作,从那时起我一直没有找到解决方案。即使从 SVN 进行干净的结帐,它仍然不起作用,它适用于除我之外的所有其他开发人员。

I have checked the paths in the error messages, they do exist and as does the target dll.

我检查了错误消息中的路径,它们确实存在,目标 dll 也是如此。

Post-Build Event in each dependant project:

每个依赖项目中的构建后事件:

copy $(TargetPath) $(ProjectDir)..\..$(Configuration)\plugins$(ProjectName).dll

The resulting error:

由此产生的错误:

error MSB3073: The command "copy C:\CMDev\CM2\Client\Apps\SSEP\Player\ACRP\CIAP\Debug\CIAP.dll C:\CMDev\CM2\Client\Apps\SSEP\Player\ACRP\CIAP....\Debug\plugins\CIAP.dll:VCEnd" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 131 5

错误 MSB3073:命令“复制 C:\CMDev\CM2\Client\Apps\SSEP\Player\ACRP\CIAP\Debug\CIAP.dll C:\CMDev\CM2\Client\Apps\SSEP\Player\ACRP\CIAP.dll。 ...\Debug\plugins\CIAP.dll:VCEnd" 以代码 1 退出。C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 131 5

Current setup:

当前设置:

  • Running Windows 7 Ultimate Service Pack 1
  • Visual Studio Pro v12.0.30723.00 Update 3, run under Administrator.
  • 运行 Windows 7 Ultimate Service Pack 1
  • Visual Studio Pro v12.0.30723.00 Update 3,在管理员下运行。

What have I tried:

我试过什么:

  • Updated Visual Studio 2013 Pro to Update 3 (from Update 1)
  • Wrapping quotes around each path with the /Y parameter e.g. copy /Y "source" "destination"
  • Tried xcopy.
  • Tried clean and re-build of eaach dependency individually.
  • Uninstalled Visual C++ 2010 and 2012, x86 and x64 Redistributable, and re-installed all 4 versions.
  • 将 Visual Studio 2013 Pro 更新为 Update 3(从 Update 1)
  • 用 /Y 参数将每个路径括起来,例如 copy /Y "source" "destination"
  • 试过xcopy。
  • 分别尝试清理和重新构建每个依赖项。
  • 卸载了 Visual C++ 2010 和 2012、x86 和 x64 Redistributable,并重新安装了所有 4 个版本。

What else can I try?

我还能尝试什么?

回答by user1883004

The problem was how VS was appending the :VCEnd suffix. Somehow the microsoft.CppCommon.targets file was modified incorrectly.

问题是 VS 如何附加 :VCEnd 后缀。不知何故, microsoft.CppCommon.targets 文件被错误地修改。

  <PropertyGroup>
      <_BuildSuffix>
:VCEnd</_BuildSuffix>
  </PropertyGroup>

回答by CJBS

When double-clicking on the compiler error, I was brought to the same file (microsoft.CppCommon.target). However, this file is installed as part of the Visual Studio installation, was not writable for save (due to its permissions), and thus seemed to be a red-herring. The content of the file was the same as that in @user1883004's answer.

当双击编译器错误时,我被带到同一个文件 ( microsoft.CppCommon.target)。然而,这个文件是作为 Visual Studio 安装的一部分安装的,不可写保存(由于其权限),因此似乎是一个红鲱鱼。该文件的内容与@user1883004's answer 中的内容相同。

With a source control system, I did the following:

使用源代码控制系统,我执行了以下操作:

  1. Close Visual Studio
  2. Delete all files from the project root, and forcibly re-download from source control
  3. Open Visual Studio, and re-compile.
  1. 关闭 Visual Studio
  2. 删除项目根目录下的所有文件,从源码控制中强行重新下载
  3. 打开 Visual Studio,重新编译。

Without a source control system, try this variation of steps:-

如果没有源代码控制系统,请尝试以下步骤变体:-

  1. Close Visual Studio
  2. Manually delete the Debug/Release (or any other generated sub-directory)
  3. Open Visual Studio, and re-compile.
  1. 关闭 Visual Studio
  2. 手动删除调试/发布(或任何其他生成的子目录)
  3. 打开 Visual Studio,重新编译。

Note that neither Clean Solutionnor Rebuild Solutionworked for me.

请注意,清洁解决方案重建解决方案都不适合我。