Getting IntelliSense in Visual Studio for NuGet .nuspec files

It couldn’t be easier. First, grab the nuspec.xsd schema file from the NuGet source and copy it into your Visual Studio XML schemas folder at C:\Program Files (x86)\Microsoft Visual Studio 10.0\Xml\Schemas. Be sure to change the install location to match your machine (32-bit, 64-bit, drive letter, etc.)

Now, associate nuspec files with Visual Studio. Easiest way is to just double-click it in Windows Explorer and follow the prompts to open it with Visual Studio.

Then, you need to ensure you nuspec files have only a single XML namespace declaration, and it should be on the root <package> element. There is a bug in the currently released version of NuGet that causes this xmlns declaration to get added to the wrong element during serialization, while also adding some extra, unneeded declarations to the root element. This issue only affects IntelliSense in Visual Studio however, and is now fixed.

For example:

<br>&lt;?xml version="1.0"?&gt;<br>&lt;package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"&gt;<br>&lt;metadata&gt;<br>&lt;id&gt;jQuery.vsdoc&lt;/id&gt;<br>&lt;title&gt;jQuery Visual Studio 2010 IntelliSense&lt;/title&gt;<br>&lt;version&gt;1.5&lt;/version&gt;<br>&lt;authors&gt;Microsoft&lt;/authors&gt;<br>&lt;description&gt;Includes vsdoc files for jQuery that provide IntelliSense in Visual Studio 2010.&lt;/description&gt;<br>&lt;summary&gt;Includes vsdoc files for jQuery that provide IntelliSense in Visual Studio 2010.&lt;/summary&gt;<br>&lt;language&gt;en-US&lt;/language&gt;<br>&lt;dependencies&gt;<br>&lt;dependency id="jQuery" version="1.5" /&gt;<br>&lt;/dependencies&gt;<br>&lt;tags&gt;jQuery VS IntelliSense&lt;/tags&gt;<br>&lt;/metadata&gt;<br>&lt;/package&gt;<br>

Once you’ve done that, you’ll get IntelliSense in VS.

IntelliSense for NuGet nuspec files in Visual Studio 2010

About these ads

3 Comments on “Getting IntelliSense in Visual Studio for NuGet .nuspec files”

  1. [...] Files (x86)Microsoft Visual Studio 10.0XmlSchemas. Be sure to change the install location to… [full post] Damian Edwards Coming up blank uncategorized 0 0 0 0 [...]

  2. Felix says:

    Hello,

    So your presentation about SignalR at Tech Ed, when will you write about it and upload the demo-code?

    Couldn’t fins any other way to contact you.

  3. Jed says:

    > It couldn’t be easier.

    I don’t think this means what you think it means. It would be easier, for example, if it was a part of the NuGet install and/or there was a NuGet package for it.

    Thanks for the walkthrough though!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 36 other followers