0

I'm looking for a way to 'privately' reference an MSBuild project so that it won't be shown to the user of the NuGet package. For example, suppose I have two libraries, LibFoo and LibBar. They're organized under a single solution, like this:

Foobar.sln
|
---- LibFoo.csproj
|
---- LibBar.csproj

Now, suppose LibFoo references LibBar. When I go to build LibFoo, LibBar is built as well. The resulting binaries are both included in LibFoo's output directory. When I nuget pack them and include everything in the directory as part of the NuGet package, LibBar's binaries are included as well.

Finally, when the end-user installs LibFoo, NuGet goes ahead and references everything in the package, including LibBar.

Is there any way to prevent this from happening?

0

1 Answer 1

2

I guess it is not possible to exclude a dll directly but you can specify explicitly which assemblies should be referenced. This in turn does what you want since all not specified assemblies won't be added as a reference.

Have a look at this section of the nuget docs.

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

1 Comment

Awesome, this was exactly what I was looking for. Thank you!

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.