在TeamCity构建配置中包括搜索路径 [英] Include Search Paths in TeamCity build Configurations

查看:236
本文介绍了在TeamCity构建配置中包括搜索路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,当Developer在其公司的机器上本地编译某个混合C ++ / C#解决方案时,他们使用.vssettings配置文件。此配置文件中包含的内容之一是引用Lib和Include文件的各种目录路径。



然而,我们的buildAgent机器(使用TeamCity)设置为无菌的,并且具有构建任何给定解决方案/项目所需的最小安装。这意味着上面的示例混合C ++ / C#项目不能访问IDE的配置,其中包括搜索路径设置。 TC通过允许您为任何给定的buildConfiguration(或甚至由buildAgent)设置所有类型的变量帐户。



但是如何获得包括搜索工作在TC的路径?我从源代码控制(Perforce)复制本地的我想包括(1),然后尝试定义环境变量(2)但是TC失败了构建(3)



我确定我的配置错了, out of what!






任何帮助将非常感激,



blong






VSC客户端映射 - Perforce


// depot / OpenSource / Boost-1.33.0 / boost / ... // team-city-agent / OpenSource / boost /...





(2)buildConfig环境变量定义



build.checkoutDir%\OpenSource





sub>(3)TC构建日志代码片段




[16:57:39] (构建目标):] e:\buildagent\work\ef1853a454da9d94\xxx\rowsbase.cpp(5,0):错误C1083:无法打开包含文件:'boost / dynamic_bitset.hpp':没有这样的文件或目录



解决方案

首先,应该尝试使用msbuild或vcbuild在命令行,因为TeamCity将做类似的事情。如有必要,请将msbuild文件夹添加到路径系统变量。然后打开命令行并输入:



msbuild.exe YourSolution.sln



$取决于您是在调试还是释放模式下执行此操作,b
$ b

msbuild.exe YourSolution.sln / p:Configuration = Release



这应该给出相同的C1083错误。



这里是修复:


  1. p>添加需要添加环境变量(实际上是系统变量)的目录的路径,我建议您调用INCLUDE。


  2. 打开文件文件夹中的VCProjectEngine.dll.config.xml ... / Microsoft Visual Studio 9.0 / VC / vcpackages /.


将INCLUDE系统变量添加到包含行。我来替换:
Include =$(VCInstallDir)include; $(VCInstallDir)atlmfc\include; $(WindowsSdkDir)\include; $(FrameworkSDKDir)include



其中:
Include =$(VCInstallDir)include; $(VCInstallDir)atlmfc\include; $(WindowsSdkDir)\include; $(FrameworkSDKDir)include; $(INCLUDE)


  1. 测试工作原理:打开一个新的命令行要考虑),并尝试如上所示构建您的解决方案。这对我来说是用于构建包含#include的文件的C ++解决方案。


  2. 现在让我们在TeamCity中工作。你可以在这一点上运行一个TC构建,看看它是否,但它不适合我。转到您的TC生成配置的属性和环境变量,并添加一个名为INCLUDE的环境变量,其值与上述INCLUDE系统变量中的路径相同。


现在这应该可以了。希望它有帮助。


Normally when a Developer compiles a certain mixed C++/C# solution locally on their machine at our company, they employ the use of a .vssettings configuration file. One of the things included in this config file is reference to various directory paths for Lib and Include files.

However, our buildAgent machines (using TeamCity) are set up to be sterile, and have the bare minimum installed on them required to build any given solution/project. This means the above exampled mixed C++/C# project wont have access to the IDE's configuration where things like include search paths were set. TC accounts for this by allowing you to set all sorts of variables for any given buildConfiguration (or even by buildAgent)....

But how do I get an Include search path to WORK in TC? I'm copying down from Source Control (Perforce) a copy local of what I want Included (1), and then trying to define an Environment Variable (2) -- and yet TC fails the build (3).

I'm sure I have something configured wrong, but for the life of me cant figure out what!


Any help would be most appreciated,

blong


(1) VSC Client Mapping - Perforce

//depot/OpenSource/Boost-1.33.0/boost/... //team-city-agent/OpenSource/boost/...


(2) buildConfig Environment Variable definition

env.Include = %system.teamcity.build.checkoutDir%\OpenSource


(3) TC build log snippet

[16:57:39]: [Project "xxx.sln" (Build target(s)):] e:\buildagent\work\ef1853a454da9d94\xxx\rowsbase.cpp(5, 0): error C1083: Cannot open include file: 'boost/dynamic_bitset.hpp': No such file or directory

解决方案

First, you should try to compile the solution yourself with msbuild or vcbuild on the command line, because TeamCity will do something similar. If necessary, add msbuild folder to the Path system variable. Then open the command line and type:

msbuild.exe YourSolution.sln

or

msbuild.exe YourSolution.sln /p:Configuration=Release

depending whether you want to do so in debug or release mode. This should give the same C1083 errors.

Here's the fix:

  1. Add the path of the directories you need to add an environment variable (in fact, system variable) that I suggest you call INCLUDE.

  2. Open the file VCProjectEngine.dll.config.xml in folder .../Microsoft Visual Studio 9.0/VC/vcpackages/.

Add the INCLUDE system variable to the include line. To me it came to replacing: Include="$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include"

with: Include="$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)\include;$(FrameworkSDKDir)include;$(INCLUDE)"

  1. Test it works: Open a new command line (need to after you change environment variables for them to be taken into account) and try to build your solution as shown above. This has worked for me to build C++ solutions with files that #include .

  2. Now let's have it work in TeamCity too. You can run a TC build at this point to see whether it does, but it didn't for me. Go to the "Properties and environment variables" of your TC build configuration, and add an environment variable named INCLUDE with value the same path(s) as in the INCLUDE system variable above.

Now this should work. Hope it helps.

这篇关于在TeamCity构建配置中包括搜索路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆