Sammy
Sammy

Reputation: 808

Ignoring Dependencies in Nuget Package

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.

Upvotes: 18

Views: 25744

Answers (2)

Icy Defiance
Icy Defiance

Reputation: 412

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.

Upvotes: 4

Joseph Devlin
Joseph Devlin

Reputation: 1800

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

Upvotes: 8

Related Questions