C#

Exploring NuGet

Since 5 hours now, I ‘m on NuGet and I’d like to share my first experiences.

Why did I join NuGet?

I joined NuGet, because it seems to be the most comfortable way to share libraries, containing XAML controls. Share them between my own projects, as well as with you.

Previously I always had to include the project containing the controls in the solution I was working on, which was really annoying..

How can you use it?

Let’s assume that you want to use a package in your project. All you need is the NuGet Package Manager Visual Studio extension. You can install it via Tools/Extensions and Updates.

To use/reference a package from NuGet right-click on the references in the solution explorer and select ‘Manage NuGet Packages’. Then you can search for the package you desire (for example ‘TCD.Serialization’) and add it to your project.

How do I use it?

At first it was a bit tricky to compose the packages. I use the “NuGet Package Explorer” to do it:

  1. Start the Package Explorer and select ‘new package’
  2. Right-click the panel on the right and select ‘lib’. Then right-click ‘lib’ and select ‘Add WinRT folder/v4.5’
  3. Add *.dll files and *.pri files to this folder.
  4. *.xaml files belong into another subfolder named like the library they belong to.

Especially 2. and 4. are important, because the package won’t be usable otherwise!

The following screenshot might be helpful as well:

ngpe

Now you might wonder why I write such a long post about this topic? The answer is simple: It took me more than 2 hours to get this NuGet stuff working, just because I found no tutorial on the web.

But now that I know how to do it, it’s really awesome =)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.