The Visual Studio extensions for Windows SharePoint Services enable developers to create efficient site definitions using Visual Studio. The trick here is that you have to actually be on the SharePoint server, but if you have access to the server, you can use a site template definition. Open that in Visual Studio, customize it by adding event handlers or workflow tasks, and then repackage it as a new site definition on a server which will allow it to be available to create sub-sites based on that new site definition.
The easiest way to do this is to start with a current site definition on the server. I am going to start with a team site, and I have created a site definition using the team site template as you can see here. I am going to select the URL for this site definition and copy that into memory by pressing Ctrl+C. The next thing that I need to do is launch the Solution Generator for the Visual Studio extensions.
I will click on Start and select SharePoint Solution Generator which opens a wizard that will generate the default site definition for me. I will choose Site Definition here and click Next. I then paste in the URL that I just copied from Internet Explorer by pressing Ctrl+V and click Next. I am going to give this a name of Enhanced Team Site and leave the location alone and click Next again. When I click Finish, I can see what’s going to happen here. It’s going to initialize, it’s going to copy the base site definition, it’s going to copy all the site properties over and update the site definition, and then it’s going to update the list of definitions and finally, clean up all the temporary files that were used to copy the data back and forth. I will click Finish and then watch the progress.
Once the Solution Generator finishes, I can click this link to see the generated solution, and then double-click the csproj file to open the solution in the Visual Studio.
Now that the solution is open in Visual Studio, I am ready to add my event handlers.