--6ren">
gpt4 book ai didi

visual-studio - Visual Studio Post-Build xcopy 不起作用 : error MSB3073: :"VCEnd" exited with code 4

转载 作者:行者123 更新时间:2023-12-05 06:41:51 25 4
gpt4 key购买 nike

我有以下构建后命令:

XCOPY "$(SolutionDir)*" "D:\VS\Win1\*" /EXCLUDE:"E:\exclude.txt" /Y /E /D

构建时我收到这些消息:

1>------ Build started: Project: Win1, Configuration: Debug Win32 ------
1> Can't read file: "E:\exclude.txt"
1>
1> 0 File(s) copied
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5):
error MSB3073: The command "XCOPY "C:\Users\Administrator\Desktop\Win1\*"
"D:\VS\Win1\*" /EXCLUDE:"E:\exclude.txt" /Y /E /D
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5):
error MSB3073: :VCEnd" exited with code 4.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

E:\exclude.txt文件内容:

.sdf

\Debug\

\ipch\

\Trash\

我不知道为什么会出现这个错误。 VS 说无法读取文件:“E:\exclude.txt” 但我检查该文件是否存在。我还阅读了关于 SO 的其他帖子,但没有看到任何有相同问题的帖子。你知道怎么解决吗?

编辑:

xcopy 复制文件成功,感谢@RustyX 的回答。但是还是报了错误码1:

1>------ Build started: Project: Win1, Configuration: Debug Win32 ------
1> tkk.cpp
1> Win1.vcxproj -> D:\T\Win1\Win1.exe
1> C:\Users\Administrator\Desktop\Win1\Source\tkk.h
1> 1 File(s) copied
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(112,5):
error MSB3073: The command "XCOPY "C:\Users\Administrator\Desktop\Win1\*"
"D:\VS\Win1\*" /EXCLUDE:E:\exclude.txt /Y /E /D
1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(112,5):
error MSB3073: echo f | XCOPY "C:\Users\Administrator\Desktop\Win1\Debug\Win1.pch"
"D:\VS\Win1\Debug\Win1.pch" /Y /E /F /D" exited with code 1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

当我在 cmd 窗口中运行此命令时,它显示 0 file copied:

XCOPY "C:\Users\Administrator\Desktop\Win1\*"
"D:\VS\Win1\*" /EXCLUDE:E:\exclude.txt /Y /E /D

和:

echo f | XCOPY "C:\Users\Administrator\Desktop\Win1\Debug\Win1.pch" 
"D:\VS\Win1\Debug\Win1.pch" /Y /E /F /D

错误是什么?

最佳答案

您的 XCOPY 命令无效。如果您在命令提示符下运行它,您会发现它不起作用:

> XCOPY "C:\Users\Administrator\Desktop\Win1\*" "D:\VS\Win1\*" /EXCLUDE:"E:\exclude.txt" /Y /E /D
Can't read file: "E:\exclude.txt"

尝试删除 /EXCLUDE: 之后的引号

XCOPY "$(SolutionDir)*" "D:\VS\Win1\*" /EXCLUDE:E:\exclude.txt /Y /E /D

关于visual-studio - Visual Studio Post-Build xcopy 不起作用 : error MSB3073: :"VCEnd" exited with code 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39287170/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com