Alex
Alex

Reputation: 38529

TFS build output path - cannot be found by OctoPack to create Nuget package

I have a fairly simple class library who's output is a single assembly. There is a build set up on TFS.

I'm using Octopack in order to package this up as a nuget package.

In my NuSpec file, I specify my <files> section like this:

This is to enable OctoPack to place the assembly in the lib folder (otherwise it just puts it in the root of the package, and therefore cannot be referenced from other projects)

The TFS build fails. The relevant parts of the log are below:

   CopyFilesToOutputDirectory:
     Copying file from "obj\Debug\Company.NameOfAssembly.dll" to "C:\Builds\4\dotNet\Company.NameOfAssembly\bin\Company.NameOfAssembly.dll".
     Company.NameOfAssembly -> C:\Builds\4\dotNet\Company.NameOfAssembly\bin\Company.NameOfAssembly.dll
     Copying file from "obj\Debug\Company.NameOfAssembly.pdb" to "C:\Builds\4\dotNet\Company.NameOfAssembly\bin\Company.NameOfAssembly.pdb".
   OctoPack:
     OctoPack: Get version info from assembly: C:\Builds\4\dotNet\Company.NameOfAssembly\bin\Company.NameOfAssembly.dll
     Using package version: 1.0.5521.18156
     OctoPack: Written files: 2
     OctoPack: Copy file: C:\Builds\4\dotNet\Company.NameOfAssembly\src\Company.NameOfAssembly\Company.NameOfAssembly.nuspec
     OctoPack: Files will not be added because the NuSpec file already contains a <files /> section with one or more elements and option OctoPackEnforceAddingFiles was not specified.
     OctoPack: Attempting to build package from 'Company.NameOfAssembly.nuspec'.
 1>MSBUILD : OctoPack error OCTONUGET: Cannot create a package that has no dependencies nor content. [C:\Builds\4\dotNet\Company.NameOfAssembly\src\Company.NameOfAssembly\Company.NameOfAssembly.csproj]

It's basically because it can't find the files in 'bin' folder, as specified in my NuSpec - Is there a way I can specify 'C:\Builds\4\dotNet\Company.NameOfAssembly\bin' in my files src?

Upvotes: 2

Views: 2334

Answers (3)

osij2is
osij2is

Reputation: 1556

I think mthierba is right; try leveraging some of the parameters the OctoPack provides. Most (if not all) of my OctoPack issues were really NuGet problems.

I'd also add that it's probably easier to try doing builds locally and customizing your NuSpec as you desire, rather than going through the hassle of constant builds on TFS and waiting for the final results. Local NuSpec customization is an effective time saver.

Upvotes: 0

mthierba
mthierba

Reputation: 5667

The problem seems to be the dot in one of your folders, and it's a NuGet issue rather than one with OctoPack. The workaround suggested here - using NuGet's -NoDefaultExcludes switch works for me (I recently came across the same problem).

With OctoPack you can specify it using the OctoPackNuGetArguments paramter, see here, where -NoDefaultExcludes is even used as an example !

Upvotes: 2

You need to remove the section and let OctoPack do the work.

P.s. Never use files in the "obj" folders...

Upvotes: 1

Related Questions