Nuget pack ProjectFile with referenced assemblies help

May 31, 2011 at 6:55 AM

Hi,

I created a few solutions with projects that get packaged as a Nuget package.

Example:

  • SolutionA
    • ProjectA
    • ProjectB
    • ProjectC
      • Reference to ProjectA
      • Reference to ProjectB
      • Reference to Package log4net
  • SolutionB
    • ProjectD
    • ProjectE
    • ProjectF
      • Reference to ProjectD
      • Reference to ProjectE
      • Reference to Package log4net

When I package ProjectC in SolutionA like: nuget pack ProjectC.csproj both ProjectA.dll and ProjectB.dll get added to the lib folder in the Nuget Package.

However, when I package ProjectF in SolutionB like: nuget pack ProjectF.csproj ProjectD.dll and ProjectE.dll are not added to the lib folder in the Nuget Package.

I have created a nuspec file for both projects: ProjectF and ProjectC using the nuget spec command and leaving the default settings in both.

Both log4net packages get added as a dependency in both nuget packages generated.

I checked that both ProjectD and ProjectE have Copy Local = true in ProjectF, as well as ProjectA and ProjectB in ProjectC. I see no difference in the settings in Visual Studio, but I am still getting this behavior.  Am I missing something?

Thanks in advance.

Developer
May 31, 2011 at 7:30 AM

You should never get ProjectA.dl or ProjectB.dll in your package. Do you have a <files> node in any of your nuspecs? Can you show the nuspec for each project and show the exact command you ran for both?

May 31, 2011 at 7:30 AM

Do ProjectD & ProjectE also happen to have a nuspec file?

May 31, 2011 at 4:04 PM
dfowler wrote:

You should never get ProjectA.dl or ProjectB.dll in your package. Do you have a <files> node in any of your nuspecs? Can you show the nuspec for each project and show the exact command you ran for both?

I thought that nuget pack got the output of the project (when running against a .csproj file) as the input for the package. I don't have any <files> node in the nuspec. Here's my nuspec:

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
  </metadata>
</package>

May 31, 2011 at 4:04 PM
davidebbo wrote:

Do ProjectD & ProjectE also happen to have a nuspec file?

Nope.

Developer
May 31, 2011 at 5:02 PM

Can you zip up you solutions and send them so we can test?

Jun 1, 2011 at 7:37 AM

Solution files can be found at:

http://dl.dropbox.com/u/28333508/WoodfinnQueue.zip

The zip contains 2 folders. Each folder contains one solution file and its projects.

Just run build.cmd for each solution and the solutions should build and the packages will be created at {SolutionDir}\build\Packages.

The solution QueueItemStore is the one where the referenced project assemblies get automatically added to the package.

The solution QueueItemMonitor is the one where the referenced project assembly does not get automatically added to the package.

I'm running the same command in the build project, and I even tried it from the command prompt.

The behavior I want to get is that of the QueueItemStore solution.

Thanks.

Developer
Jun 1, 2011 at 7:55 AM

Thanks, I'll take a look.

That doesn't work today (or at least isn't supposed to by default). What we do plan to did plan to do is treat project references as dependencies instead of including multiple assemblies in the project.

Jul 25, 2011 at 2:19 PM

Any timeline of this treating project references as dependencies?

I Actually this right now :)

Regard

Dennis