Embed vs link to my dependencies: Best practices for .NET / NuGet package?
I am providing a C # /. NET class library to clients at my company as a NuGet package. My library depends on some other third party libraries (like Newtonsoft excellent Json.NET ).
I assume the standard NuGet way is that my package will only include references to other NuGet packages that I depend on. The Developer Studio client will automatically download these when you install the NuGet package into its project.
Question number 1:
How can I be sure that Developer Studio will download versions of the NuGet packages I created against, and not the "latest" versions?
Question number 2:
Will this cause problems if their project also uses a third party library that I am using (like Json.NET), especially if they are using a different version? "It just works," or do I need to do something?
Sorry if this is outlined somewhere, but I could not find specific answers to these questions.
source to share
This is clearly stated in the Nuspec Reference
In particular:
Setting dependencies
Starting with version 2.0, package dependencies can be specified depending on the structure profile of the target project. Element contains a set of elements. Each group contains zero or more elements and attributes of the target structure. All dependencies within a group are installed together if the target structure is compatible with the project structure profile.
<dependencies> <group> <dependency id="RouteMagic" version="1.1.0" /> </group> <group targetFramework="net40"> <dependency id="jQuery" /> <dependency id="WebActivator" /> </group> <group targetFramework="sl30"> </group> </dependencies>
Where version:
The range of versions acceptable as a dependency. This is usually just a version number, which represents the minimum version. However, the more explicit version range syntax is supported .
( update : updated links to more recent version of nuget)
source to share