17

I have a package which has 5 dependencies -- one of which is MVC3. While installing this package, I want to ignore the dependency on MVC3 alone. Is there a way I can do that?

In the Nuget Package Manager Console, there's an option to ignore dependencies when installing packages --

Install-Package <package name> -IgnoreDependencies

I want to know if there is a way to mention a specific dependency to ignore, rather than ignoring all dependencies.

Sammy
  • 798
  • 2
  • 8
  • 23

2 Answers2

7

If you are creating your own package you an add the following to your nuspec

<?xml version="1.0" encoding="utf-8"?>
<packages>
    <package id="MVC3" version="1.6.4" developmentDependency="true"     />
</packages>

Note the line beginning <package. When creating your own package you can exclude individual packages using developmentDependency="true". This will remove that package as a dependency. The example I have provided is just dummy data. You can read more about this feature here

Joseph Devlin
  • 1,754
  • 1
  • 26
  • 37
4

The docs don't name any options like that. You'll have to ignore all dependencies, then install the ones you need separately. I believe you'll also have to ignore all dependencies when calling Update-Package, and update the other dependencies individually, if you ever use that.

If you're the creator of the package, you can set MVC3 as a development dependency, but that won't help if someone else controls the package.

Icy Defiance
  • 412
  • 7
  • 6