Mark Good
Mark Good

Reputation: 4303

NuGet: Do Not Set Assembly Reference

I have created a nuget package containing a DLL that I want to share with multiple applications. I want to add this package to applications without setting a reference to the DLL. I am using dependency injection to load this DLL or a test DLL at run-time.

By default, nuget automatically sets a reference to all DLLs contained lib during installation.

Is there any way to configure the nuget package to not set a reference to the DLL when it is installed into my project?

Upvotes: 0

Views: 327

Answers (1)

zivkan
zivkan

Reputation: 14991

Explicit assembly references. Although if your dll is loaded entirely at runtime (using MEF or Assembly.Load or something similar), then the build system might not copy the dll to the project's output directory. Note these docs are only correct for packages.config projects. I have a PR to improve the docs to explain how to do the equivalent thing for PackageReference.

Upvotes: 1

Related Questions