Nuget: specify dependency without adding links

I have a package (say MyStuff.Data) that requires EntityFramework (and others) to work, but only internally. I don't want every project that uses MyStuff.Data to also reference EntityFramework (and everyone else), but the dll should always be there.

Is it possible to add EntityFramework depending on MyStuff.Data (so that it collects EntityFramework.dll in the package folder), but without a link added to every project that uses it?

+7
source share
1 answer

No no. An option could be to embed the EntityFramework dll and send it inside your own package, and explicitly indicate which links should be added to the target project during installation. You can specify this using the metadata element in the nuspec package. More information can be found in the docs: http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Explicit_Assembly_References

Please note that investing in a specific version of a dependency is a limiting restriction for all your consumers, which means that you, as a package manufacturer, will manage the version of EF that your consumers can and will use ... which is not a good situation.

Preferably, you try to ignore any uncontrolled (EF) dependencies and leave the real choice of implementation to the consumer (or you provide a separate package containing the implementation, so your consumers can still choose and use yours).

+3
source

All Articles