MSB3073:命令“mc :VCEnd”以代码 1 退出

Posted

技术标签:

【中文标题】MSB3073:命令“mc :VCEnd”以代码 1 退出【英文标题】:MSB3073: The command "mc :VCEnd" exited with code 1 【发布时间】:2019-09-13 05:36:04 【问题描述】:

我正在尝试在 Visual Studio 2019 中编译 log4cpp_x86,但它给了我如下错误,

我尝试将项目的位置从 D: 更改为 C:,但问题仍然存在,并且我将文件夹取消标记为 ReadOnly 但它也不起作用。

当我点击错误,即标记为 MSB3073 时,它会将我重定向到 Microsoft.CppCommon.targets 中的行,该行的 xml 标记为:

  <Exec Command="%(CustomBuildStep.Command)$(_BuildSuffix)"/> 

【问题讨论】:

@HansPassant 但是构建事件中没有编写构建后命令,但是我在 C++ 项目解决方案文件中看到该命令如下,&lt;CustomBuildStep&gt; &lt;Command&gt;mc $(InputPath)&lt;/Command&gt; &lt;/CustomBuildStep&gt; 别人有这个问题,考虑用他找到的the workaround。 @HansPassant 感谢该链接..我尝试了该解决方案,但在执行 将 HAVE_SNPRINTF 添加到预处理器定义之后,它给了我 错误:C2084 log4cpp_x86 函数' int vsnprintf(char *const ,const size_t,const char *const ,va_list)' 已经有正文了 【参考方案1】:

@HansPassant 建议link 在我的情况下是它的一半解决方案,但在按照该链接中建议的过程之前,我用下面的 xml 标记替换了整个 log4cpp 项目的解决方案文件损坏,

<CustomBuildStep> <Command>mc $(InputPath)</Command> </CustomBuildStep>

旧项目的解决方案文件带有以下标签,

<CustomBuild Include="..\NTEventLogCategories.mc">
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug with Boost|Win32'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h "$(OutDir)" -r "$(OutDir)" "$(ProjectDir)..\%(Filename).mc"
rc.exe -r -fo "$(OutDir)%(Filename).res" "$(OutDir)%(Filename).rc"
link.exe /MACHINE:IX86 -dll -noentry -out:"$(OutDir)NTEventLogAppender.dll" "$(OutDir)%(Filename).res"
</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug with Boost|x64'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h "$(OutDir)" -r "$(OutDir)" "$(ProjectDir)..\%(Filename).mc"
rc.exe -r -fo "$(OutDir)%(Filename).res" "$(OutDir)%(Filename).rc"
link.exe /MACHINE:IX86 -dll -noentry -out:"$(OutDir)NTEventLogAppender.dll" "$(OutDir)%(Filename).res"
</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug with Boost|Win32'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug with Boost|x64'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h "$(OutDir)" -r "$(OutDir)" "$(ProjectDir)..\%(Filename).mc"
rc.exe -r -fo "$(OutDir)%(Filename).res" "$(OutDir)%(Filename).rc"
link.exe /MACHINE:IX86 -dll -noentry -out:"$(OutDir)NTEventLogAppender.dll" "$(OutDir)%(Filename).res"
</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h "$(OutDir)" -r "$(OutDir)" "$(ProjectDir)..\%(Filename).mc"
rc.exe -r -fo "$(OutDir)%(Filename).res" "$(OutDir)%(Filename).rc"
link.exe /MACHINE:IX86 -dll -noentry -out:"$(OutDir)NTEventLogAppender.dll" "$(OutDir)%(Filename).res"
</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release with Boost|Win32'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h $(OutDir) -r $(OutDir) $(ProjectDir)..\%(Filename).mc
RC.exe -r -fo $(OutDir)%(Filename).res $(OutDir)%(Filename).rc
link.exe /MACHINE:IX86 -dll -noentry -out:$(OutDir)NTEventLogAppender.dll $(OutDir)%(Filename).res
</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release with Boost|x64'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h $(OutDir) -r $(OutDir) $(ProjectDir)..\%(Filename).mc
RC.exe -r -fo $(OutDir)%(Filename).res $(OutDir)%(Filename).rc
link.exe /MACHINE:IX86 -dll -noentry -out:$(OutDir)NTEventLogAppender.dll $(OutDir)%(Filename).res
</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release with Boost|Win32'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release with Boost|x64'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h $(OutDir) -r $(OutDir) $(ProjectDir)..\%(Filename).mc
RC.exe -r -fo $(OutDir)%(Filename).res $(OutDir)%(Filename).rc
link.exe /MACHINE:IX86 -dll -noentry -out:$(OutDir)NTEventLogAppender.dll $(OutDir)%(Filename).res
</Command>
      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">"$(VS100COMNTOOLS)vsvars32.bat" if not exist $(OutDir) md $(OutDir)
mc.exe -h $(OutDir) -r $(OutDir) $(ProjectDir)..\%(Filename).mc
RC.exe -r -fo $(OutDir)%(Filename).res $(OutDir)%(Filename).rc
link.exe /MACHINE:IX86 -dll -noentry -out:$(OutDir)NTEventLogAppender.dll $(OutDir)%(Filename).res
</Command>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)NTEventLogAppender.dll;%(Outputs)</Outputs>
    </CustomBuild> 

然后我按照@HansPassant 建议的链接步骤进行操作,但是我没有按照link 中的第一步(即下载新版本的log4cpp),而是将项目替换为旧项目,然后根据该链接中的建议遵循所有程序,这解决了我的问题。

【讨论】:

以上是关于MSB3073:命令“mc :VCEnd”以代码 1 退出的主要内容,如果未能解决你的问题,请参考以下文章

错误 66 error MSB3073: 命令“mkdir ..\..\..\:VCEnd”已退出,代码为 1

UE4 [MSB3073] 命令“X:engineEngineBuildBatchFilesBuild.bat -WaitMutex -FromMsBuild”已退出,代码为 6解决

UE4 [MSB3073] 命令“X:engineEngineBuildBatchFilesBuild.bat -WaitMutex -FromMsBuild”已退出,代码为 6解决

VS2010 error MSB3073 代码为1

[CMakList][原创]error MSB3073: 命令“setlocal解决的3种方法

MSVC2013:如何避免使用错误的预构建脚本中止构建过程(错误 MSB3073: :VCEnd" 退出,代码 -1)