9

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 all those others), but the dll always needs to be there.

Is there any way I can add EntityFramework as a dependency of MyStuff.Data (so that it picks up EntityFramework.dll in the packages folder), but without a reference being added to each project that consumes it?

1 Answer 1

4

No there is not. An option could be to embed the EntityFramework dll and ship it inside your own package, and explicitly state which references should be added in the target project during installation. You can specify this using the metadata element in the nuspec of you package. More information can be found in the docs here: http://docs.nuget.org/docs/reference/nuspec-reference#Specifying_Explicit_Assembly_References

Notice that embedding a specific version of a dependency is a limiting constraint on all your consumers, which means that you, as a package producer, will be driving which version of EF your consumers can and will be using... which is not a good situation to be in.

Preferably, you try to abstract out any non-controlled (EF) dependency and leave the real implementation choice to the consumer (or you provide a separate package containing the implementation, so your consumers can still opt-in and use yours).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.