使用MSBuild命令行实用程序时出错

时间:2012-03-01 00:17:02

标签: msbuild x86-64

我有一个Visual Studio 2008解决方案文件和一台Windows 7(64位)计算机。

我正在尝试使用MSBuild命令从* .sln文件构建解决方案,但是收到错误。

我收到以下错误:“MSB4018:”ResolveVCProjectOutput“任务意外失败(见http://connect.microsoft.com/VisualStudio/feedback/details/349531/msb4018-the-resolvevcprojectoutput-task-failed-unexpectedly)。

使用64位版本的msbuild.exe修复了此错误,但是出现了此错误: MSB3411:无法加载Visual C ++组件“VCBuild.exe”

要解决此问题,我将 C:\ Program Files(x86)\ Microsoft Visual Studio 9.0 \ VC \ vcpackages 添加到我的路径中。

现在我收到链接器错误和以下警告:

警告MSB3428:无法加载Visual C ++组件“VCProjectEngine.dll”

警告MSB3425:无法解析VC项目引用“something.vcproj”。

此外,看起来项目没有按.sln文件指定的顺序构建。

我现在正在获取 MSB4018:“ResolveVCProjectOutput”任务再次意外失败错误。

可能与64位msbuild.exe调用32位dll有关吗? 或者它可能与我的Visual Studio设置中某些路径中是否有预期引号有关? 或者它可能与无序构建的项目有关吗?



以下是诊断详细程度级别的输出吐出:

Initial Items:
_SolutionProjectProjects
    ..\SOME_LIB\trunk\msvc_2008\SOME_LIB_LIB.vcproj
    helpers\msvc_2005\helpers.vcproj
    My Sandbox\My Sandbox.vcproj

Building with tools version "2.0".
Target "ValidateSolutionConfiguration: (TargetId:2)" in file "" from project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (entry point):
Task "Error" skipped, due to false condition; (('$(CurrentSolutionConfigurationContents)' == '') and ('$(SkipInvalidConfigurations)' != 'true')) was evaluated as (('<SolutionConfiguration xmlns=""><ProjectConfiguration Project="{A1B06ADE-974B-4B50-A77E-2FB1AC97FFB5}">Debug|Win32</ProjectConfiguration><ProjectConfiguration Project="{28215158-9138-4D90-8B11-461278300EF3}">Debug|Win32</ProjectConfiguration><ProjectConfiguration Project="{3901755B-0BE2-479D-81BE-B98B61BF337F}">Debug|Win32</ProjectConfiguration></SolutionConfiguration>' == '') and ('' != 'true')).
Task "Warning" skipped, due to false condition; (('$(CurrentSolutionConfigurationContents)' == '') and ('$(SkipInvalidConfigurations)' == 'true')) was evaluated as (('<SolutionConfiguration xmlns=""><ProjectConfiguration Project="{A1B06ADE-974B-4B50-A77E-2FB1AC97FFB5}">Debug|Win32</ProjectConfiguration><ProjectConfiguration Project="{28215158-9138-4D90-8B11-461278300EF3}">Debug|Win32</ProjectConfiguration><ProjectConfiguration Project="{3901755B-0BE2-479D-81BE-B98B61BF337F}">Debug|Win32</ProjectConfiguration></SolutionConfiguration>' == '') and ('' == 'true')).
Using "Message" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "Message" (TaskId:2)
  Building solution configuration "Debug|Win32". (TaskId:2)
Done executing task "Message". (TaskId:2)
Done building target "ValidateSolutionConfiguration" in project "My Sandbox.sln".: (TargetId:2)
Target "ValidateToolsVersions: (TargetId:3)" in file "" from project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (entry point):
Task "Error" skipped, due to false condition; ('$(MSBuildToolsVersion)' == '2.0' and ('$(ProjectToolsVersion)' != '2.0' and '$(ProjectToolsVersion)' != '')) was evaluated as ('3.5' == '2.0' and ('' != '2.0' and '' != '')).
Done building target "ValidateToolsVersions" in project "My Sandbox.sln".: (TargetId:3)
Target "Build: (TargetId:4)" in file "" from project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (entry point):
Task "MSBuild" skipped, due to false condition; (@(BuildLevel0) != '') was evaluated as ( != '').
Task "Message" skipped, due to false condition; (@(SkipLevel0) != '') was evaluated as ( != '').
Task "Warning" skipped, due to false condition; (@(MissingConfigLevel0) != '') was evaluated as ( != '').
Using "CallTarget" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CallTarget" (TaskId:3)
Target "helpers: (TargetId:5)" in file "" from project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (target "Build" depends on it):
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Using "VCBuild" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "VCBuild" (TaskId:4)

  Locating vcbuild.exe: Visual C++ Express is not installed on this computer. (TaskId:4)
  Locating vcbuild.exe: falling back to the system PATH variable. (TaskId:4)
  Command: (TaskId:4)
  C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\VCBuild.exe "C:\Users\cmorris\Documents\Projects\My Sandbox\helpers\msvc_2005\helpers.vcproj" "Debug|Win32"  (TaskId:4)
  The "VCBuild" task is using "VCBuild.exe" from "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\VCBuild.exe". (TaskId:4)
  Microsoft (R) Visual C++ Project Builder - Command Line Version 9.00.21022 (TaskId:4)
  Copyright (C) Microsoft Corporation. All rights reserved. (TaskId:4)
   (TaskId:4)
  Build started: Project: helpers, Configuration: Debug|Win32 (TaskId:4)
  helpers - up-to-date (TaskId:4)

Done executing task "VCBuild". (TaskId:4)
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Release_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Release_static') and ('Win32' == 'Win32') ).
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Release') and ('Win32' == 'Win32') ).
Done building target "helpers" in project "My Sandbox.sln".: (TargetId:5)
Target "SOME_LIB_LIB: (TargetId:6)" in file "" from project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (target "Build" depends on it):
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Task "VCBuild" (TaskId:5)

  Locating vcbuild.exe: Visual C++ Express is not installed on this computer. (TaskId:5)
  Locating vcbuild.exe: falling back to the system PATH variable. (TaskId:5)
  Command: (TaskId:5)
  C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\VCBuild.exe "C:\Users\cmorris\Documents\Projects\My Sandbox\..\SOME_LIB\trunk\msvc_2008\SOME_LIB_LIB.vcproj" "Debug|Win32"  (TaskId:5)
  The "VCBuild" task is using "VCBuild.exe" from "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcpackages\VCBuild.exe". (TaskId:5)
  Microsoft (R) Visual C++ Project Builder - Command Line Version 9.00.21022 (TaskId:5)
  Copyright (C) Microsoft Corporation. All rights reserved. (TaskId:5)
   (TaskId:5)
  Build started: Project: SOME_LIB_LIB, Configuration: Debug|Win32 (TaskId:5)
  SOME_LIB_LIB - up-to-date (TaskId:5)

Done executing task "VCBuild". (TaskId:5)
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Release_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Release_static') and ('Win32' == 'Win32') ).
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Release') and ('Win32' == 'Win32') ).
Done building target "SOME_LIB_LIB" in project "My Sandbox.sln".: (TargetId:6)
Done executing task "CallTarget". (TaskId:3)
Task "MSBuild" skipped, due to false condition; (@(BuildLevel1) != '') was evaluated as ( != '').
Task "Message" skipped, due to false condition; (@(SkipLevel1) != '') was evaluated as ( != '').
Task "Warning" skipped, due to false condition; (@(MissingConfigLevel1) != '') was evaluated as ( != '').
Task "CallTarget" (TaskId:6)
Target "helpers" skipped. Previously built successfully.
Target "SOME_LIB_LIB" skipped. Previously built successfully.
Target "My Sandbox: (TargetId:7)" in file "" from project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (target "Build" depends on it):
Task "ResolveVCProjectOutput" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Using "CreateItem" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "CreateItem" (TaskId:7)
Done executing task "CreateItem". (TaskId:7)
Task "ResolveVCProjectOutput" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Task "CreateItem" (TaskId:8)
Done executing task "CreateItem". (TaskId:8)
Task "CreateTemporaryVCProject" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Task "VCBuild" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Task "Delete" skipped, due to false condition; ( ('$(Configuration)' == 'Debug_static') and ('$(Platform)' == 'Win32') ) was evaluated as ( ('Debug' == 'Debug_static') and ('Win32' == 'Win32') ).
Using "ResolveVCProjectOutput" task from assembly "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "ResolveVCProjectOutput" (TaskId:9)
  Resolving VC project reference "C:\Users\cmorris\Documents\Projects\My Sandbox\helpers\msvc_2005\helpers.vcproj". (TaskId:9)
MSBUILD : error MSB4018: The "ResolveVCProjectOutput" task failed unexpectedly. [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018: System.ArgumentException: Illegal characters in path. [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at System.IO.Path.CheckInvalidPathChars(String path) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at System.IO.Path.IsPathRooted(String path) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.Tasks.ResolveVCProjectOutput.ResolveUsingVCEngineObjectModel(ITaskItem projectRef, String configName, String& resolvedAssemblyPath, String& resolvedImportLibraryPath) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.Tasks.ResolveVCProjectOutput.Execute() [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
Done executing task "ResolveVCProjectOutput" -- FAILED. (TaskId:9)
Done building target "My Sandbox" in project "My Sandbox.sln" -- FAILED.: (TargetId:7)
Done executing task "CallTarget" -- FAILED. (TaskId:6)
Done building target "Build" in project "My Sandbox.sln" -- FAILED.: (TargetId:4)
Done Building Project "C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (build target(s)) -- FAILED.
Deferred Messages

Detailed Build Summary
======================
     (TaskId:0)

  ============================== Build Hierarchy (IDs represent configurations) =====================================================
  Id                  : Exclusive Time   Total Time   Path (Targets)
  ----------------------------------------------------------------------------------------------------------------------------------- (TaskId:0)
  0                   : 0.944s           0.944s       C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln (build)  (TaskId:0)

  ============================== Node Utilization (IDs represent configurations) ====================================================
  Timestamp:            1        Duration   Cumulative
  ----------------------------------------------------------------------------------------------------------------------------------- (TaskId:0)
  634661562995558093:   0        0.944s     0.944s ################## (TaskId:0)
  -----------------------------------------------------------------------------------------------------------------------------------
  Utilization:          100.0    Average Utilization: 100.0 (TaskId:0)

Project Performance Summary:
      943 ms  C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln   1 calls
                943 ms  build                                      1 calls

Target Performance Summary:
        0 ms  ValidateToolsVersions                      1 calls
       20 ms  ValidateSolutionConfiguration              1 calls
      149 ms  My Sandbox                                 1 calls
      367 ms  helpers                                    1 calls
      385 ms  SOME_LIB_LIB                                   1 calls
      913 ms  Build                                      1 calls

Task Performance Summary:
        2 ms  CreateItem                                 2 calls
       20 ms  Message                                    1 calls
      146 ms  ResolveVCProjectOutput                     1 calls
      751 ms  VCBuild                                    2 calls
      913 ms  CallTarget                                 2 calls

Build FAILED.

"C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln" (build target) (1) ->
(My Sandbox target) -> 
  MSBUILD : error MSB4018: The "ResolveVCProjectOutput" task failed unexpectedly. [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018: System.ArgumentException: Illegal characters in path. [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at System.IO.Path.CheckInvalidPathChars(String path) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at System.IO.Path.IsPathRooted(String path) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.Tasks.ResolveVCProjectOutput.ResolveUsingVCEngineObjectModel(ITaskItem projectRef, String configName, String& resolvedAssemblyPath, String& resolvedImportLibraryPath) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.Tasks.ResolveVCProjectOutput.Execute() [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]
MSBUILD : error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult) [C:\Users\cmorris\Documents\Projects\My Sandbox\My Sandbox.sln]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.97

2 个答案:

答案 0 :(得分:0)

“使用64位版本的msbuild.exe修复了此错误,但是出现了此错误:MSB3411:无法加载Visual C ++组件”VCBuild.exe“”

64位MSBuild无法加载VCBuild.exe,因为它是32位应用程序。

MsBuild直接构建解决方案是否有问题?

msbuild SlnFolders.sln /t:build ...

答案 1 :(得分:0)

刚遇到同样的问题。我在msbuild Framework64目录中明确地运行了%windir%\Microsoft.NET。但路径设置错误。

正在运行vcvars64首先解决了问题。