1

Let's say that I have 2 class libraries.

I have included a NuGet package in project A. I need to instantiate classes from that package in project B.

Should I simply add references to the package by browsing from project A and point out the dll? Or is there another option?

2 Answers 2

1

You can add the same NuGet package in project B and use it.

Package manager in Visual Studio creates a directory inside your SoutionDir called "packages", it contains all NuGet dlls from all projects. So it does not download it 2 times...

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

Comments

0

If you need classes from a package, add the package reference in project B through Nuget Package.

If you just need the classes from project A in project B, then add reference to project A from project B.

3 Comments

Wrong, you shouldn't reference Project A if the only reference your really need is in the NuGet Package. Reference the NuGet Package in Project B instead.
@phifi He said he needed classes from project A, so he must reference project A.
ok, maybe he is not clear enough in his question, but he wrote "I need to instantiate classes from that PACKAGE".

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.