HowTo: Making your SharePoint 2010 project template behave as a web application – part 2

In part 1 of this little series I explained some of the background details of why the new SharePoint project template in Visual Studio 2010 annoys me.

How to solve it

So my mission was now to make it (the template) understand both SharePoint-ish and Web Application-ish.
My investigation started with looking at the project files (the xml part that is):

The topmost image is the SharePoint template and the one below is the Web Application template.
Looking at the ProjectTypeGuids we can see the following:

{BB1F664B-9266-4fd6-B973-E1E44974B511} – ?? probably the SharePoint stuff

{14822709-B5A1-4724-98CA-57A101D1B079} – SharePoint Workflow

{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} – Windows C#

{349c5851-65df-11da-9384-00065b846f21} – Web application

Perhaps we can combine them?
I made a couple of attempts here going with updating a web application to a sharepoint application first but that didn´t work out so great so my recommendation is:

  1. Create a new empty SharePoint project and an empty web application project in the same solution
  2. Unload both the project and edit the project files in the xml view. Combine the two project by updating the SharePoint template so the new ProjectTypeGuids looks like below:

    <ProjectTypeGuids>{BB1F664B-9266-4fd6-B973-E1E44974B511};{14822709-B5A1-4724-98CA-57A101D1B079};{349c5851-65df-11da-9384-00065b846f21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

    Note: The order of these guids seem to be very important so it should like above.

  3. Reload the two projects (leave the web application project untouched)…and when you do that you will see the conversion wizard:

    Click through that wizard…

    Important: When you get to this screen (below) click “NO”!

    OK, so now it works!!

    Or…it kind of works. You still can´t get add new items to show the asp.net stuff but the thing that works is that if you do the same stuff as I showed you in part 1 (adding items to web.config and copy/paste .master pages) the intellisense works…or the VS environment seems to understand what a web.config file is.
    And, the great part is that the goody SharePoint stuff also works (features, packaging etc):

    I´ll leave this with a “works on my box warranty” and be posting again on other stuff related to this.
    Hope it helps someone out there and that we might get a supported update for this from Microsoft (please…)

    PS. Next on my list is making web.config transformations work in SharePoint land… DS.

, , , ,

  1. Leave a comment

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

%d bloggers like this: