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.
Any time a package is installed or reinstalled, which includes being installed as part of a restore process, NuGet also installs any additional packages on which that first package depends. Those immediate dependencies might then also have dependencies on their own, which can continue to an arbitrary depth.
A Visual Studio project is defined by a . csproj file, which is an XML file that holds different configuration settings for the project. The information about the NuGet package dependencies for your project is stored in this . csproj file.
To manage your package sources, select the Settings icon or select Tools > Options. In the Options window, expand the NuGet Package Manager node and select Package Sources. To add a source, select +, edit the Name, enter the URL or path in Source, and then select Update.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With