Monday, January 24, 2011

Getting Started with NuGet Packages step by step overview.

We can all see lots of buzz about NuGet in asp.net world. So I decided to explore it. let’s explore it in some details. Following is a explanation of NuGet Extension on the code plex here.



"NuGet is a Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects that use the .NET Framework. When you add a library or tool, NuGet copies files to your solution and automatically makes whatever changes are needed in your project, such as adding references and changing your app.config or web.config file. When you remove a library, NuGet removes files and reverses whatever changes it made in your project so that no clutter is left."

So in simple words is a Visual Studio Extension which will help you the add,remove and update libraries in your visual studio project.

Installing NuGet

Let’s see how we can install it. For that first you have to go thorough the Tools->Extension Manager and then search for nuget and it will appear in the list like below.

NugetInstallation

After that click on download and it will download and install it from the web. Make sure your computer has access to internet. Once you download your nugest extension it will ask you to restart visual studio. So once your are restarted you are ready with nuget packages.

How to install packages with NuGet

Here, I am going to install Entity Framework code first CTP 5 package with NuGet. To install that package first you have to go right click your project and then click add Library Reference Package like following.

AddLibraryPackage

After that a reference dialog will appear their you have click online and search entity as we need to install entity framework ctp. After searching the right package click on install it will start installing your package. Following is screen host of add library package reference dialog.

EntityFramework

After clicking install EFlicence dialog will appear like this.

EFCodeFirst

Click on I Accept and install will install package.After installing package a green icon will appear on top as indication of your successful installation like following.

AfterInstallation

Now after clicking on close if you see on your project reference An Entity framework is added to your project reference like following.

EntityFrameworkReference

Also you can see a package.config will be added to your project. like following.

<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EFCodeFirst" version="0.8" />
</packages>
That's it your package is installed and ready to use in your application. There is another way of adding packages with package console is also there. I will explain this on future blog posts. Hope you liked this. Stay tuned for more..
Technorati Tags: ,
Shout it
Share:

1 comment:

  1. nuget package 5.0 taking to much time to install in visual studio 2014 professional,

    what to do?

    help me please!

    ReplyDelete

Your feedback is very important to me. Please provide your feedback via putting comments.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews