cool breeze
cool breeze

Reputation: 4811

How to correctly reference a nuget package so it won't hard code a path

What is the best way to reference a libarary downloaded using nuget?

When I go to references and then find the path to the library inside of the packages folder, it seems to include my TFS branch path in the reference path.

How do I get it to reference the dll in a more generic way?

I don't see the "installed packages" options either:

enter image description here

Upvotes: 1

Views: 426

Answers (2)

Leo Liu
Leo Liu

Reputation: 76670

What is the best way to reference a libarary downloaded using nuget?

You should set that nuget package to a local feed, then manage it with nuget.

Detail steps:

Create local feed:

  1. Go to Tools->Options->NuGet Package Manager->Package Sources, click the green plus button, then add a available package source and configure the Name of package source and Source:

    enter image description here

  2. Add the downloaded package to the load feed, which you set in the Source of package source in the first step.

Manage package with nuget:

Right click on the References, select Manage NuGet packages..., select local feed source on the opened NuGet Package Manager window, find the downloaded package, then you can add it by clicking Install button:

enter image description here

Hope this helps.

Upvotes: 2

Peter Ruderman
Peter Ruderman

Reputation: 12485

Don't reference the package directly. Add the package to the project using Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution.

Upvotes: 0

Related Questions