在VSTS中自动化后,Nuget Packaging失败

时间:2016-07-05 10:24:07

标签: nuget nuget-spec azure-pipelines

对于我经常用于各种项目的公共库,我设置了一个nuget服务器。有一段时间我手动发布了nuget包,如:

nuget pack .\ProjectFolder\CommonProjectName.csproj -Symbols -Build -Properties Configuration=Release

并将此包手动推送到nuget服务器。

现在我想使用此博客项目中描述的VSTS Build vNext自动执行此发布:http://www.codewrecks.com/blog/index.php/2015/09/26/publishing-a-nuget-package-to-nugetmyget-with-vso-build-vnext/

我使用与以前相同的nuspec文件:

<?xml version="1.0"?>
  <package >
    <metadata>
      <id>Common Library</id>
      <version>1.0.0.0</version>
      <title>Library Title</title>
      <authors>...</authors>
      <owners>...</owners>
      <requireLicenseAcceptance>false</requireLicenseAcceptance>
      <description>...</description>
      <releaseNotes>...</releaseNotes>
      <copyright>Copyright 2016</copyright>
      <tags>...</tags>
      <dependencies>
        <dependency id="EntityFramework" version="6.1.3" />
        <dependency id="log4net" version="2.0.4" />
        <dependency id="Microsoft.AspNet.Mvc" version="5.2.3" />
        <dependency id="Microsoft.AspNet.Razor" version="3.2.3" />
        <dependency id="Microsoft.AspNet.WebPages" version="3.2.3" />
        <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
      </dependencies>
  </metadata>
</package>

现在自动化之后我收到以下错误消息:

描述:程序集'bin \ Release \ CommonLibrary.dll'不在'lib'文件夹中,因此当程序包安装到项目中时,它不会被添加为引用。 解决方案:如果应该引用它,将其移动到'lib'文件夹中。 问题:在lib文件夹外组装。

我在nuget网站上阅读了软件包约定部分,但我如何自动遵守这些约定。换句话说,如何在我的buidcontroller中将构建和引用的dll放在正确的位置。

感谢您的帮助,

亲切的问候, Luuk Krijnen

额外:使用FTP下载nuget软件包之后我的完整源代码以及我的编译源代码将像我的原始源代码一样添加到树中的软件包中。所以我编译的dll在de文件夹中。\ Bin \ Release \

1 个答案:

答案 0 :(得分:0)

将文件部分添加到添加目标的nuspec文件似乎是解决方案:

<?xml version="1.0"?>
  <package >
    <metadata>
      <id>Common Library</id>
      <version>1.0.0.0</version>
      <title>Library Title</title>
      <authors>...</authors>
      <owners>...</owners>
      <requireLicenseAcceptance>false</requireLicenseAcceptance>
      <description>...</description>
      <releaseNotes>...</releaseNotes>
      <copyright>Copyright 2016</copyright>
      <tags>...</tags>
      <dependencies>
        <dependency id="EntityFramework" version="6.1.3" />
        <dependency id="log4net" version="2.0.4" />
        <dependency id="Microsoft.AspNet.Mvc" version="5.2.3" />
        <dependency id="Microsoft.AspNet.Razor" version="3.2.3" />
        <dependency id="Microsoft.AspNet.WebPages" version="3.2.3" />
        <dependency id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
      </dependencies>
  </metadata>
  <files>
       <file src="<TARGET SPECIFIC FILE.DLL>" target="lib" />
       <file src="<TARGET SPECIFIC FILE.PDB>" target="lib" />
       ...
  </files>
</package>