0

对于我经常用于各种项目的公共库,我设置了一个 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\

4

1 回答 1

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>
于 2016-07-05T12:58:04.173 回答