NuGet Integration in WebMatrix 2 Beta

We're always on the lookout for opportunities to integrate services that streamline development tasks. In this release, we've built in direct support for NuGet, the package distribution service. Using this tool, you can install, manage, and use packages that take care of popular tasks like social network integration, mobile browser support, and more.

In This Article



Accessing Packages through the Ribbon (top)

In WebMatrix 1, you can add packages using the Web Pages administration panel that runs in the browser. For WebMatrix 2, we've added a gallery inside WebMatrix, which reduces the time and steps needed to get a package. To access the gallery, do this:

  1. Open up any Web Pages site in WebMatrix. Alternatively, create a new site using any of the templates except Empty Site.
  2. Switch to the Files workspace. In the ribbon, you'll see a NuGet section with a Gallery button. If it doesn't appear, make sure you're in a Web Pages site by looking for a .cshtml file in the file list.

    clip_image001

    Note:
    due to a Beta bug, the extension button may take a couple seconds to load.

Let's explore.



Viewing all Packages (top)

First, we put together a list of packages we think will be most useful. To see this featured list, click the bottom of the Gallery button. (This is also a shortcut for viewing packages you've installed.)

clip_image002

There are many packages aside from those we feature. To view all of the packages, do this:

  1. Launch the NuGet gallery
  2. Click the All category.
  3. To look for a specific package or type of package, type a keyword in the search box.
  4. To view package details click the title below the package icon.

    clip_image003



Installing a package (top)

There are a couple ways to install a NuGet package. To install a featured package, do this:

  1. Click the bottom half of the Gallery button.
  2. Click the icon of the package you want to install.
  3. On the details page that is displayed, click the Install button and follow the instructions.

To install a package from the gallery, do this:

  1. Click the top half of the Gallery button.
  2. Click All in the category list.
  3. Click a package icon and then click Install, or just double-click the package icon.

When the installation completes, the following status bar message is displayed:

clip_image004



Learning about a Package (top)

There are a few ways to learn more about a package.

  1. Click an installed package in the bottom of the NuGet gallery. This launches the package details page. If the package has a More about this package link, click that.
  2. If a package doesn't have a More about link, look for a .cshtml file that's related to the package in the App_Code directory. If you find a .cshtml file, enter the name of that file in the editor and then use IntelliSense to explore the package:

    clip_image005

    You can also open the .cshtml file to see the code for that package.
  3. If the package doesn't have a More about link and has .dll files instead of .cshtml file, search for the package name online to find out more about it.



Updating a Package (top)

Package authors occasionally update their packages. If so, the gallery will tell you that an update is available. To learn about the update and install it, do this:

  1. Click the top half of the Gallery button
  2. Click Updates in the category list

    clip_image006
  3. To view details about the update, click the package title.
  4. From the details page, click the Update button to proceed with the update.

    -or-
  5. To update directly, click the package and then click the Update, or just double-click the package icon.
  6. Follow the instructions to complete the update.



Uninstalling a Package (top)

If you no longer want a package you can uninstall it. WebMatrix will remove everything that was installed with the package.

  1. Click the top half of the Gallery button
  2. Click Installed in the category list.

    clip_image007
  3. To uninstall, click the package icon and then click Uninstall, or just double-click the package.



Configuring and Using Custom Feeds (top)

If you have a custom NuGet package feed, you can add and use it by doing the following:

  1. Click the top half of the Gallery button
  2. Click on the drop-down list below the gallery title and click Add source.

    clip_image008
  3. In the dialog that appears, specify a name and the URL of the package feed you want to add, and click the Add button. You can add multiple feeds at once.

    clip_image009

    Note: Sources can be HTTP URLs or, as pictured, local or shared directories with .nupkg files in them.
  4. Click OK to return to the NuGet gallery.
  5. In the feed list drop down, you will now see and can select the new feed you added.

    clip_image010

 

Learn More about WebMatrix 2 Beta

If you want to learn more about other great features in WebMatrix 2 Beta, check out some of these articles:

You can discuss this article using the adjacent Facebook talkback.

For technical questions please visit our discussion forums, where we have a vibrant community of developers like you, as well as Microsoft engineers who are ready to answer your questions!