C++ 错误 MSB3073:我该如何解决这个问题?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19914339/
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-27 23:14:54  来源:igfitidea点击:

error MSB3073: How do I fix this?

c++mfc

提问by CodeDoctorJL

3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command "copy "C:\Users\jlee\Desktop_IPG2.7_4\InitialPowerGadget\Release\EnergyLib.dll" "C:\Users\jlee\Desktop_IPG2.7_4\InitialPowerGadget\Bins32\EnergyLib32.dll"
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: copy "C:\Users\jlee\Desktop_IPG2.7_4\InitialPowerGadget\EnergyDriver\objfre_win7_x86\i386\EnergyDriver.sys" "C:\Users\jlee\Desktop_IPG2.7_4\InitialPowerGadget\Bins32"
3>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd" exited with code 1.

I was researching online, I think it has to do something with relative pathing; but I'm not sure. Can someone help explain what is wrong and how to fix this?

我在网上研究,我认为它必须用相对路径做一些事情;但我不确定。有人可以帮助解释什么是错误的以及如何解决这个问题吗?

回答by ernst

In my case the problem was that VC++ was trying to copy a .dll file into a system folder. Running it as administrator fixed the problem.

就我而言,问题在于 VC++ 试图将 .dll 文件复制到系统文件夹中。以管理员身份运行它解决了问题。

回答by David

For anyone else that comes across this question my problem was that the target directory contained spaces i.e.

对于遇到这个问题的其他人,我的问题是目标目录包含空格,即

C:\Users\Administrator\Documents\Visual Studio 2017\projects\blah

C:\Users\Administrator\Documents\Visual Studio 2017\projects\blah

So for me the solution was to wrap $(TargetDir) in double quotes i.e.

所以对我来说,解决方案是将 $(TargetDir) 用双引号括起来,即

copy ..\resources\* "$(TargetDir)" /Y

复制 ..\resources\* "$(TargetDir)" /Y

回答by Semjon M?ssinger

I had the following situation: I was trying to overwrite write-protected files with an post-build event copy. I need some time to find it out because I copied various files, some were copied with success some not. But for all events an error was displayed. In the example below copy event 4, 5 and 6 failed which was indicated before the error with "Zugriff verweigert" (engl.: access denied):

我遇到了以下情况:我试图用构建后事件副本覆盖写保护的文件。我需要一些时间来找出它,因为我复制了各种文件,有些复制成功,有些没有。但是对于所有事件,都会显示错误。在下面的示例中,复制事件 4、5 和 6 失败,这是在“Zugriff verweigert”错误之前指示的(英文:访问被拒绝):

enter image description here

在此处输入图片说明

回答by Jie He

Get it. I have set up a post build event to run the unit tests automatically after each build. Delete this configure, can solve this.

得到它。我已经设置了一个构建后事件来在每次构建后自动运行单元测试。删除这个配置,可以解决这个问题。

enter image description here

在此处输入图片说明

回答by Mazen Keeikati

Just add your user to permission for cmd.exe file in system32. that will solve this problem.

只需将您的用户添加到 system32 中 cmd.exe 文件的权限即可。这将解决这个问题。