【问题标题】:VS2017 Pre-Build TF.exe checkout exited with code 3VS2017 Pre-Build TF.exe 签出退出,代码为 3
【发布时间】:2018-07-22 03:06:45
【问题描述】:

我们有一个 Pre-Build 事件,它应该检查我们的 AssemblyInfo.cs 文件,以便下一个 Pre-Build 事件可以转换我们的 AssemblyInfo.tt T4 模板并生成一个新的 AssemblyInfo.cs 文件 - 这是我们的程序集版本控制解决方案。

但是,预构建事件命令“突然”开始失败 - 它们之前工作正常,查看源代码控制历史记录,没有人更改命令。

我已取出文本转换命令以消除潜在问题。

现在唯一的预构建事件是:

"$(VS100COMNTOOLS)..\IDE\TF.exe" checkout "$(ProjectDir)Properties\AssemblyInfo.cs"

我已经打开了构建的“诊断”级别输出,这就是它所说的:

1>  Task Parameter:Command="..\IDE\TF.exe" checkout "C:\_dev\CCM\Development\SAPN.CCM\SAPN.CCM.Service.Core\Properties\AssemblyInfo.cs"
1>   (TaskId:18)
1>  "..\IDE\TF.exe" checkout "C:\_dev\CCM\Development\SAPN.CCM\SAPN.CCM.Service.Core\Properties\AssemblyInfo.cs"
1>   (TaskId:18)
1>  The system cannot find the path specified. (TaskId:18)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1274,5): error MSB3073: The command ""..\IDE\TF.exe" checkout "C:\_dev\CCM\Development\SAPN.CCM\SAPN.CCM.Service.Core\Properties\AssemblyInfo.cs"
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1274,5): error MSB3073: " exited with code 3.
1>Done executing task "Exec" -- FAILED. (TaskId:18)
1>Done building target "PreBuildEvent" in project "SAPN.CCM.Service.Core.csproj" -- FAILED.: (TargetId:20)

我意识到它说“系统找不到指定的路径”,但我检查了路径,它是正确的。

我什至尝试过像这样在 VS 开发者命令提示符中直接运行 TF.exe 命令:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community>TF.exe checkout "C
:\_dev\CCM\Branches\CCA-Service-NoERTinSettings\SAPN.CCM\SAPN.CCM.Service\Proper
ties\AssemblyInfo.cs"

这就成功了。

谁能看到可能导致 Pre-Build 事件失败的原因?

【问题讨论】:

    标签: visual-studio-2017 pre-build-event


    【解决方案1】:

    问题是环境变量 VS100COMNTOOLS 不存在于系统中。

    经思考,这是因为卸载了 VS2010。

    我通过在 PreBuild 事件中将 VS100COMNTOOLS 替换为 VS140COMNTOOLS 解决了这个问题,该事件引用了指向 Visual Studio 2015 常用工具的环境变量。

    遗憾的是,这种方法依赖于安装了特定版本的 Visual Studio 的开发人员......如果我找到与版本无关的解决方案,我会更新这个答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-10
      • 1970-01-01
      • 2015-09-17
      • 1970-01-01
      相关资源
      最近更新 更多