Andrew Connell

SharePoint 2010 Dev TidBit - Small bug in VS2010 Beta 2 SharePoint Tools (that's fixed in RTM)

I ran into this doing a few code samples for SharePoint 2010 using the Visual Studio 2010 Beta 2 SharePoint tools. Passing it along as it threw me for a loop when I first saw it. First, in case you aren't aware, the SharePoint "things" you add to a project in Visual Studio 2010 are called SharePoint Items (SPI's). This includes things like Web Parts, Visual Web Parts, Content Types, etc. Basically anything that has a Item Template in Visual Studio 2010 is is a SPI. So what's the issue? Well, in Visual Studio 2010 Beta 2, the SharePoint tools make the assumption that if you don't have any SPI's in the project, even if it is a SharePoint project, it will not package anything up. For instance try the following: Create a new project of type Empty SharePoint Project. Add a single class to the project. Right-click the project name and select Package. When you look, there won't be anything in the WSP! But wait... even though it may not be common, wouldn't you want to create an assembly and deploy it to the GAC/BIN of a site, but not include anything else in the package? Maybe so! Unfortunately...

I ran into this doing a few code samples for SharePoint 2010 using the Visual Studio 2010 Beta 2 SharePoint tools. Passing it along as it threw me for a loop when I first saw it.

First, in case you aren’t aware, the SharePoint “things” you add to a project in Visual Studio 2010 are called SharePoint Items (SPI’s). This includes things like Web Parts, Visual Web Parts, Content Types, etc. Basically anything that has a Item Template in Visual Studio 2010 is is a SPI.

So what’s the issue? Well, in Visual Studio 2010 Beta 2, the SharePoint tools make the assumption that if you don’t have any SPI’s in the project, even if it is a SharePoint project, it will not package anything up. For instance try the following:

  • Create a new project of type Empty SharePoint Project.
  • Add a single class to the project.
  • Right-click the project name and select Package. When you look, there won’t be anything in the WSP!

But wait… even though it may not be common, wouldn’t you want to create an assembly and deploy it to the GAC/BIN of a site, but not include anything else in the package? Maybe so! Unfortunately the Visual Studio 2010 Beta 2 SharePoint tools won’t allow it. Now you can get around this behavior by building the project and then going into the Package designer to manually add a reference to the assembly. But that’s just annoying.

The good news: this is addressed in the RTM release of Visual Studio 2010… it will include any output by the project template in the WSP package. So if you’re working with beta 2, just giving you a heads up.

Andrew Connell
Founder & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to delivering industry-leading on-demand video training to professional developers. He lives with his wife & two kids in Florida.