用于TFS持续集成的NuGet包 [英] NuGet pack for TFS Continuous Integration

查看:123
本文介绍了用于TFS持续集成的NuGet包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进行TFS生成过程,以从解决方案的项目中生成NuGet软件包.我们旨在创建一个私有软件包源,因此所有其他内部产品都可以使用NuGet下载/更新框架.

I'm trying to make our TFS Build process to generate NuGet packages from our solution's projects. We aim to create a private package source, so all other internal products may download/update the framework using NuGet.

到目前为止,我们已经使构建过程运行了很长时间(很长时间)并对我们的库进行了版本控制,剩下的唯一事情就是" nuget pack "所有项目.

So far we've got the build process running (for a long time) and versioning our libraries, and the only thing that's left is to "nuget pack" all the projects.

到目前为止,我已经尝试过:

  1. nuget spec * .csproj,然后是nuget pack * .nuspec;
  2. nuget spec * .dll,然后是nuget pack * .nuspec;
  3. 直接获取* .csproj的nuget包(没有.nuspec文件);

它们似乎都起作用,但是它们似乎都在我实际需要它们成功的步骤上失败.

我从执行上述步骤中实际上得到了什么:

What I actually get from doing the mentioned steps:

    列出了
  1. 依赖项¹,列出了参考²;

  1. No dependency¹ listed, no reference² listed;

依赖性¹,列出了参考²,该目录中的所有dll都打包在相同的.nupkg文件中(使用-IncludeReferencedProjects暂停);

No dependency¹ listed, no reference² listed, all dlls from the directory are packed on the same .nupkg (whitout using -IncludeReferencedProjects);

(迄今为止最好的),列出了一些依赖项,没有引用²,只有实际的项目dll位于.nupkg上的lib文件夹中. /p>

(The best so far) Some dependencies¹ listed, no reference² listed, only the actual project dll is inside the lib folder on the .nupkg.

¹:我所说的依赖关系是指NuGet依赖关系,即来自NuGet的软件包
²:引用是指解决方案项目的引用.

¹: By dependency I mean NuGet dependencies, the packages from NuGet
²: By reference I mean solution project references.

示例场景:

Solution1.sln
-ProjectA
-ProjectB

Solution1.sln
-- ProjectA
-- ProjectB

ProjectA具有对ProjectB的项目参考.我 期望 在生成的.nuspec上发生的事情:

ProjectA has a Project Reference to ProjectB. What I expect to happen on the .nuspec generated:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
  <metadata>
    <id>ProjectA <- OK</id>
    <version>1.2.0.0 < - OK</version>
    <title>ProjectA <- OK</title>
    <authors>My Company <- OK</authors>
    <owners>My Company <- OK</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Description</description>
    <copyright>OK</copyright>
    <dependencies>
        <dependecy id="ProjectB" Version="1.2.0.0" /> <<<<<<---- NOT HAPPENING!
    </dependencies>
  </metadata>
</package>    

列出了一些nuget依赖项,但不是全部(即使它们位于重新引用的项目的packages.config中).例如:我有一个项目依赖于其他4个NuGet包,其中仅2个作为对生成的.nuspec文件的依赖项列出.

Some nuget dependencies are listed, but not all of them (even when they are inside the packages.config from the refeered project). For example: I have a project that dependends on 4 other NuGet packages, only 2 are listed as dependencies on the generated .nuspec file.

重要信息:

  • 每个项目都有其自己的package.config,即NuGet构建它的方式;
  • 解决方案文件夹包含packages文件夹,其中包含所有引用的软件包;
  • 已尝试使用Nugetter(XAML在VS 2012.3和TFS 2012上损坏,无法打开)
  • 已经尝试过,也没有正确包含依赖项和引用;
  • 解决方案软件包还原已打开(我们需要这样做,以避免将软件包存储在TFS上).
  • Every project has its own packages.config, the way NuGet builds it;
  • The solution folder contains the packages folder, with all referenced packages;
  • Already tryed Nugetter (XAML broken on VS 2012.3 and TFS 2012, cannot open it)
  • Already tryed this, also does not include the dependencies and references properly;
  • Solution package restore is turned ON (we need this to avoid storing the packages on TFS).

我需要什么:

  • 自动执行打包过程以打包每个csproj,包括.nuspec文件上的所有引用和依赖项,因此在安装时将正确加载所有这些引用和依赖项.

我研究过的类似问题:

NuGet:pack命令不包括nuget依赖项
Nuget包仅包括某些项目的依赖项
为什么打包时nuget不包含引用的项目?

NuGet: pack command is NOT including nuget dependencies
Nuget pack only including dependencies for some projects
Why doesn't nuget include the referenced project when packing?

推荐答案

事实证明这是一个简单的路径问题.未正确添加引用和依赖项,因为我正在从其他工作目录执行命令.

It turns out to be a simple path problem. The references and dependencies were not being properly added because I was executing the command from a different working directory.

最重要的是,必须使用-IncludeReferencedProjects来正确添加所需的所有内容.

On top of that, the use of -IncludeReferencedProjects was necessary to properly add everything needed.

此后,使用Powershell的构建过程成功完成,一切都按预期进行了=)

After that the build process using Powershell completed successfully and everything is worked as expected =)

这篇关于用于TFS持续集成的NuGet包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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