Using Libraries

Course Home | What are packages? | packages.config Example

When I’m working with Visual Studio I managed all my packages using NuGet.

When working with NuGet we have a few ways to import libraries in to our projects. Libraries are done on a project level, not solution. We’ll cover two of them.

The first is to use the Package Manager, which can be found at Project > Add NuGet Packages. This will open up the following window where you’ll be able to search for the library you require, select the version and add it to your project. This will download the library and add it to a folder called ‘packages’ in your project.

NuGet Package Manager

Doing the above, will automatically create the second option available to us, manually updating the ‘packages.config’ file. By using the method above you’ll now see a file called ‘packages.config’ in your project, if you open it, you’ll see something like this:


You can see we have the name of the package, it’s version and also what version of .net it’s targeting. The targetFramework isn’t really something you need to care about right now, but let’s say you were building a project using .NET framework 3.8, the above packages wouldn’t be compatible as they are too new. So if you knew the name of the library you required, you could manually enter it here.

A third option which we aren’t going to cover, but I want to make you aware of is via the console. It’s also possible to use the NuGet Pacakage manager via the command line.

Next Lesson ➔

Richard Bradshaw's photo

Richard Bradshaw


Software Tester, speaker and trainer at Friendly Testing. BossBoss at Ministry of Testing. Whiteboard Testing creator. Striving to improve the testing craft.