I have created a NuSpec file for my .NET Project as follows:
<?xml version="1.0"?>
<package>
<metadata>
<id>$id$</id>
<version>$version$</version>
<title>$title$</title>
<authors>Author</authors>
<description>My Project</description>
<owners>Me</owners>
<dependencies>
</dependencies>
</metadata>
</package>
My project also has two NuGet provided dependencies, these being:
<package id="Autofac" version="3.5.2" targetFramework="net451" />
<package id="Autofac.Extras.NLog" version="1.2.3" targetFramework="net451" />
When I create the NuGet package for my project using this NuSpec, NuGet is smart enough to pull these addtional dependencies in. When I install my NuGet package in a new Project, I also get the Autofac
and Autofac.Extras.NLog
dependencies too, referenced and automatically inserted into the packages.config for my new Project.
However... the version of Autofac I get is wrong. Rather than version 3.5.2
I get version 2.6.1.841
:
<package id="Autofac" version="2.6.1.841" targetFramework="net451" />
<package id="Autofac.Extras.NLog" version="1.2.3" targetFramework="net451" />
Now, Autofac.Extras.NLog
has a dependency of ≥ 2.2.4.900
(at time of writing). I have two questions:
- It looks as though NuGet is first fulfilling the
Autofac.Extras.NLog
Autofac dependency by installingAutofac 2.6.1.841
. When it then comes to fulflling my project's Autofac depdency, it is seeing that Autofac is already installed and therefore does nothing. How can I make NuGet resolve the Autofac dependency to version3.5.2
? - Even though NuGet is resolving the 'wrong' NuGet depdendency (at least for my purposes), why is it resolving to
2.6.1.841
rather than2.2.4.900
, which is the minimum version specified in theAutofac.Extras.NLog
dependency?