使用NuGet软件包构建团队城市 [英] Team city build with NuGet packages

查看:77
本文介绍了使用NuGet软件包构建团队城市的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Team City中建立了一个构建,在测试项目中带有NuGet包参考.

I have set up a build in team city, with a NuGet package reference in the test project.

我使用的文件夹structre是

The folder structre I have used is

\
|- Project1
  \- Project1.csproj
|-  Project1.Test
 \- Project1.Test.csproj
|- packages
 \- lib
  \- RhinoMocks

Project1项目成功构建,但是Test项目在ResolveAssemblyReferences步骤中失败.相对路径似乎不正确.

The Project1 project builds sucessfully, but the Test project fails on the ResolveAssemblyReferences step. The relative path seems to be incorrect.

[13:16:55]: [ResolveAssemblyReference] C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360, 9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
[13:16:55]: [ResolveAssemblyReference]         For SearchPath "{HintPathFromItem}".
[13:16:55]: [ResolveAssemblyReference]         Considered "..\packages\RhinoMocks.3.6\lib\Rhino.Mocks.dll", but it didn't exist.

TeamCity构建配置:

TeamCity build config:

  • MSBuild任务
  • 构建文件路径:Project1.Test \ Project.Test.csproj
  • 工作目录:%system.teamcity.build.checkoutDir%\ Project1.Test
  • VCS根指向上面的文件夹结构的根.

据我所知这可能是一个MSBuild问题,当我在构建代理的checkout文件夹中的命令行中运行MSBuild时,会遇到相同的错误.

As far I can tell this may be a MSBuild issue, I get the same error when I run MSBuild at the command line in the checkout folder on the build agent.

更多信息:提示路径由Nuget软件包配置提供.在Visual Studio中,程序包引用可以正常工作.但是,通过MSBuild运行时,似乎对其当前目录感到困惑... \ packages ...路径实际上是Nuget的逐字引用路径.

More info: The hint path is being provided by the Nuget package configuration. Within Visual Studio the package reference works correctly. However, when running via MSBuild, it seems confused about its current directory. The ..\packages... path is actually the verbatim reference path from Nuget.

推荐答案

我对您的项目结构的这一部分感到困惑:

I'm confused about this part of your project structure:

|- packages
 \- lib
  \- RhinoMocks

如果要从NuGet中拉出软件包,则没有必要.应该检查到源代码管理中包"下的唯一文件是repositories.config.

This shouldn't be necessary if you're pulling the packages in from NuGet. The only file under "packages" that should be checked into source control is repositories.config.

此外,当TeamCity运行MSBuild时,如何下载相关的NuGet依赖项?是通过TeamCity的"NuGet安装程序"完成的,还是您已将解决方案/项目配置为自动运行nuget安装?

Also, when TeamCity runs MSBuild, how are you downloading the relevant NuGet dependencies? Is it via the TeamCity "NuGet Installer" or have you configured your Solution/Projects to auto run nuget install?

这篇关于使用NuGet软件包构建团队城市的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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