Saturday, July 16, 2011

Upgrade your version of WSPBuilder for a more traditional development experience

In many ways a seasoned ASP.Net developer can have a difficult time learning SharePoint 2007 development because they have become accustomed to the practices ascribed to by the Microsoft ASP.Net team. One of these practices is so benign and intuitive, that most developers find it incomprehensible that it is not available when using a WSPBuilder project template. The practice that I am referring to is right clicking your declarative markup and selecting “View Code”. The menu item is not available, because the WSPBuilder Project type is based on the standard C# project type, and does not include the web application project type. Because of this, you cannot add regular web application based items such as web forms and web controls. This has lead many developers, including myself, to develop SharePoint solutions by hand, manually linking our declarative markup and code behind files, all the while not using designers and in some cases intellisense.

As I mentioned, the culprit in this case is the WSPBuilder project template. Specifically, it does not add the proper id’s the <ProjectTypeGuids> element of the WSPBuilder project file that is created. To remedy this, open your existing WSPBuilder project .cs file with a text editor and modify the following line:




This will correct the project file so that you can now magically add web forms, web controls, and yes… “View Code” from your declarative markup!

But, better yet, the newest version of WSPBuilder has fixed this issue, and if you simply upgrade your WSPBuilder installation, any new projects that you create using the WSPBuilder project templates will correctly support the web project template. Make sure to get WSPBuilder Version 1.4 (currently in Beta). They may have fixed this issue in other releases, but I have only tested it in the 1.4 beta release.

No comments:

Post a Comment