0

I have a class library with numerous projects, each referencing each other, written in C#. This is a common library that I share with other projects. I have recently changed the mechanism that the library is shared to be via nuget. So for each project within the library, I have a post build event to create a nuget package eg.

"$(SolutionDir)\NuGet.exe" pack "$(ProjectPath)" -o "$(SolutionDir)\Packages"

This works nicely. It pushes the package to a shared folder in the file structure and the consuming project installs it from there. All projects packages are pushed to this folder.

I have ran in to a problem though. Lets say my library creates package X and Y. X has a reference to Y in the class library. In the consuming application, I need to use X, when I install it, it doesnt install the ddl from Y. I also need to install package Y. How can I set it up when package X is created, it also includes the necessary dlls's from package Y, without having to explicitly install it?

1 Answer 1

2

in the nuspec file of package X you can specify package Y as dependency

<dependencies>
<dependency id="Y" version="1.0" />
</dependencies>

More options around dependency can be found here http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Dependencies

For specifying files you could use
<files>
<file src="bin\Debug*.dll" target="lib" />
<file src="bin\Debug*.pdb" target="lib" />

</files>
More details here http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Files_to_Include_in_the_Package

1
  • Can you specify dlls as dependencies and will they get referenced in the consuming project?
    – amateur
    Dec 6, 2012 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.