0

For a Common library I use very often for all kinds of projects, I setup a nuget server. For a while i published the nuget package manually like:

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

and pushed this package manually to the nuget server.

Now I want to automate this publishing using VSTS Build vNext as described in this blogitem: http://www.codewrecks.com/blog/index.php/2015/09/26/publishing-a-nuget-package-to-nugetmyget-with-vso-build-vnext/

I use the same nuspec file as before:

<?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>

Now after automation i get the following error messages:

Description: The assembly 'bin\Release\CommonLibrary.dll' is not inside the 'lib' folder and hence it won't be added as reference when the package is installed into a project. Solution: Move it into the 'lib' folder if it should be referenced. Issue: Assembly outside lib folder.

I read the package conventions section at the nuget site but how do I automatically comply with these conventions. In other words how do I get the builded and referenced dll's in the right place at my buidcontroller.

Thanks for the help,

Kind regards, Luuk Krijnen

Extra: after downloading the nuget package using FTP my complete sourcecode as wel als my compiled sources are added to the package in a tree just like my original source code. So my compiled dll is inside de folder .\Bin\Release\

Luuk Krijnen
  • 1,180
  • 3
  • 14
  • 37

1 Answers1

0

Adding a files section to the nuspec file adding a target seems the solution:

<?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>
Luuk Krijnen
  • 1,180
  • 3
  • 14
  • 37