Back to previous

Setting up a core framework for Sharepoint Webpart

I was trying to create a web part with WSPBuilder installed on Visual Studio 2008, but had the problem of rendering a user control. Then I came across this blog post, which explains the steps in wrapping usercontrol with WSPBuilder solution. What's even greater is we can setup a structure which seperates the application presentation layer with the WSP project.

One thing though, is that we need to make sure the Assembly registration tag in the usercontrol is above the Control registration tag, or else when we render in Sharepoint, it will complain as Codebind class not found or could not load the assembly error. Greg's post is just excellent and easy to follow.

A sample framework is attached here. Generally, everytime a fresh roll off, we need to:

  1. Rename the both projects to whatever we want to create.
  2. Change the solution file to update the new project names.
  3. In CorePart project, add a new WSPBuilder Web part Feature, that will create all required files.
  4. Update CorePartUI properties -> namespace and also post build event commands to whatever we named CorePart project.
  5. Create a usercontrol in UI project and now start developing.

Everytime we build UI project, everything in it will be compiled to a dll and get placed in Core project's GAC folder. And then what we do is WSPBuilder -> Build the Core project and deploy it. This is a nice platform as we can include as many tools, utilities, functions we use often in the UI (a web application) project, and also be able to use its designer mode to do any design, rather than doing everything in code behind.

ShareThis

If you think this post is useful, please recommend me at the bottom of the page. ;)

Discussion