2011-12-26 12 views
10

VS2010で開発されたC++プロジェクト(コンソール32ビットアプリケーションのようなもの)は、PC(Windows 7 32-bit) 。私のPCにはMicrosoft SDK 7.0Aがインストールされています。これはVS2010にバンドルされていると思います。
Visual Studioがインストールされていないビルドサーバーでプロジェクトを構築しようとしましたが、そこにはMicrosoft SDK 7.1のみが存在します。
私は(これは最終的にはチームシティーのランナーのための課題となります)のMSBuildの助けを借りて、プロジェクトをビルドしようとすると、ビルドサーバー上で、私はエラー(詳細なログが提供される)以下の取得:私はWindows SDK 7.1(ただし、VS2010なし)のPCでC++プロジェクトを構築

Project "E:\win\core.sln" on node 1 (default targets). 
ValidateSolutionConfiguration: 
    Building solution configuration "Debug|Win32". 
Project "E:\win\core.sln" (1) is building "E:\win\core_unittests.vcxproj" (2) on node 1 (default targets). 
Project "E:\win\core_unittests.vcxproj" (2) is building "E:\cpptest\win\cpptest.vcxproj" (3) on node 1 (default targets). 
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.Targets(847,9): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [E:\cpptest\win\cpptest.vcxproj] 
C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(297,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [E:\win\cpptest.vcxproj] 
InitializeBuildStatus: 
    Touching "E:\cpptest\win\..\..\..\out\Debug\cpptest\cpptest.unsuccessfulbuild". 
ClCompile: 
    C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"E:\cpptest\win\..\..\..\out\Debug\cpptest\\" /Fd"E:\cpptest\win\..\..\..\out\Debug\cpptest\vc100.pdb" /Gd /TP /analyze- /errorReport:queue ../missing.cpp 
    missing.cpp 
e:\cpptest\missing.cpp(36): fatal error C1083: Cannot open include file: 'windows.h': No such file or directory [E:\cpptest\win\cpptest.vcxproj] 

をmsbuildが"E:\Program Files\Microsoft SDKs\Windows\v7.1"にインストールされているMicrosoft SDKを見つけることができないことに関連しているとします。

Web上で利用できる、この問題を処理するために、どのようにいくつかのアドバイスがあります

  1. HKCUHKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1下のレジストリの一部をコピーします(WindowsSdkDir is not set correctly in Visual Studio 2008?を参照してください)。私はこの回避策を試していませんでした。なぜなら、あまりにも醜いので、ビルドプロセスはSYSTEMアカウントの資格情報で実行されるからです。
  2. TeamCity and MSBuild Quirks #1で提案されているように、MSBuildの追加パラメータとしてWindowsSDKDirを渡します。
  3. answerInclude Search Paths in TeamCity build Configurationsで提案されているようにVCProjectEngine.dll.config.xmlを調整してください(Windows SDKを使用しているPCでそのファイルが見つかりませんでした)。
  4. the answerWindowsSdkDir is not set correctly in Visual Studio 2010で提案されているプロジェクトプロパティのプラットフォームツールセットを変更してください(私のPCにWindows SDK 7.1がインストールされていないため、これが役立つとは思えません)。実際

CL.EXEすべてをコンパイルする(私は定義されINCLUDELIB変数を持っているので)罰金になり、環境変数を渡す/使用するMSBuildのを強制的にこの問題を回避するだろう...

あります同様の問題:

とにかくは、Windows SDKがインストールされたPCにVisual C++ 2010プロジェクトを作成するのに成功しました

答えて

11

最終的には、問題の実行可能で意味のある回避策が見つかりました。"Can we build *.vcxproj(c++ project) using MSBuild 4.0 without installing the Visual Studio 2010?"の中にあります。
要約:VS2010を使用しないでPCにソリューションを構築するときに、プラットフォームツールセットを明示的に指定する必要があります。あなたのプロジェクトがv100またはプラットフォームツールセットとして指定v90を持っている場合は、おそらく同じ道を行く必要があります

msbuild /p:PlatformToolset=Windows7.1SDK core.sln 

:コマンドは次のようになります。

TeamCityの愛好家には、唯一のWindows SDKがインストールされたPC上でサーバーを実行するためのヒントが追加されています。
すべてのビルドステップを変更するのではなく、エージェントのプロパティにPlatform Toolsetを指定すれば十分です。

system.PlatformToolset=Windows7.1SDK 

をハッピービル:その?:\TeamCity\buildAgent\conf\buildAgent.propertiesに次の行を追加を行うには ! :)

+0

こんにちは、Visual Studio 2010 C++ Team City Agentを使用したビルドサーバーでプロジェクトを実行するMSBuildがmspdb100.dll DLL – Stefano

+0

@Stefanoが見つからない場合、MSBuildは、通常、適切な解決方法は、 '%PATH%'に 'mspdb100.dll'のディレクトリを追加することです。 – AntonK

1

また、このノード&の値をレジストリに追加することもできます(インストールディレクトリ&が32/64バージョンになる)。

---ためのMSBuildスクリプト %のPROGRAMFILES(x86の)%\ MSBuildの\マイクロソフトの

--- ---

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Setup\VS] 
"ProductDir"="C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\" 

---最後.regファイルを.regファイルを開始.Cpp \ v4.0 \ Platforms \ Win32 \ PlatformToolsets \ Windows7.1SDK \ Microsoft.Cpp.Win32.Windows7.1SDK.props "VSInstallDirを検索してください。