Apr
16
2008
I’ve spent the last couple weeks trying to create a custom site definition for SharePoint 2007. If you’re unsure of what a custom site definition is and how it differs from a site template, there is a good MSDN article which explains both.
I found a bunch of good resources out there that describe the steps in creating a custom site definition, but none gave me everything I needed. I will give a brief rundown of the steps that I followed, and provide links to the articles that I referenced.
- Download WSPBuilder and the WSPBuilder Extensions for Visual Studio. (I believe you need to install the Visual Studio SDK prior to installing the extensions)
- In Visual Studio create a new WSPBuilder Project.
- I don’t know if it is supposed to be this way or just a problem that I was having, but it did not create the entire 12 hive folder structure like I thought it would. To fix this, I ran WSPBuilder.exe –createfolder true from the command line, and then added the resulting folder structure to my Visual Studio project.
Then follow these steps: Creating a Custom WSS Site Definition [2007]
- In the example from that article, the author uses a folder named SampleMPS. In your Visual Studio project, you will be using the \12\TEMPLATE\ directory.
Now, I wanted to associate a custom masterpage to my site definition. The steps I followed to do that are outlined here: http://statto1974.wordpress.com/2007/04/30/using-a-custom-master-page-in-a-site-definition/. Put your master file in the \12\TEMPLATE\SiteTemplates\v2DefaultOrg\ (where v2DefaultOrg is whatever you named your site definition) directory, beside the default.aspx file. Below is a screenshot of my project folder structure. You’ll notice the eight folders in my FEATURES folder. The first is a feature that, when activated, associates a site with a new custom masterpage (read more). The remaining seven are custom list definitions. I have two site definitions in my project 1) v2DefaultOrg and 2) v2DefaultUser.
Once you have everything setup as you like. Right-click on the project and choose WSPBuilder –> Deploy. Then go into SharePoint and test out your Site Definition by creating a new site using it.
When you’re ready and it’s time to package it up and deploy it on your production SharePoint farm. Right-click on the project again and choose WSPBuilder –> Create deployment folder.
Then go to your project BIN folder and you’ll see a deploy folder. Inside this folder you should see a setup.exe and a .wsp file. The .wsp file is the Solution Package, and the setup.exe is from the SharePoint Solution Installer project on CodePlex. You’ll need to create and modify a configuration file as described on the SharePoint Solution Installer home page.
Then you simply need to run the setup.exe and the project should install on your SharePoint farm.
As I’ve found creating and deploying a custom site definition can be frustrating. Hopefully the information I’ve provided will be of help to someone.
no comments | tags: C#, MOSS 2007, SharePoint | posted in .NET
Feb
6
2008
I’m a lazy programmer. Don’t get me wrong, I think that’s a good thing. I believe it drives me to come up with innovative solutions for problems that I’m too lazy to deal with on a regular basis. This frees me up to work on the things that I enjoy, while spending less time on the tedious.
Lately I’ve turned to CMS systems like Kentico, Drupal, and Joomla when I’m creating websites, because I can spend more time on the design and layout and less time developing the backend.
Sometimes, I want more control than a CMS allows, and I want to write more code. In the past I’ve written my own data access layer, and in most cases that works just fine. However, i “need to spend more time with [my] friends, family, dog, bird, cat…” so I started looking for solutions…and I found several:
To be fair, I only tried the first three because they’re open source (free), and in the end, SubSonic met all my needs. It is easy to use. All you really need to do, it setup the database connection string in the app.config/web.config file, run a macro, and sit back and drink your coffee. In the end you’re presented with a couple classes for each table in your database.
Then creating a table record is as easy as:
user = new UserObject(1);
user.FirstName = "Adam";
user.LastName = "Conde";
user.EmailAddress = "myemail@something.com";
user.Save();
Querying is similarly easy.
Check it out for yourself: SubSonic: All Your Database Are Belong To Us
no comments | tags: .NET, C#, SQL | posted in .NET, C#, SQL