A while ago, I released my little executable for creating WSPs that could be incorporated into the build process of Visual Studio 2005 similar to Carsten Keutmann's WSPBuilder. The downfall was that there was a lot of configuration you had to do to get it working. So, now I've created a Visual Studio project template which is pre-configured with all the needed elements for building the WSP. All you need to to is use the choose the project template and build.
Here's what you need to get going...
1) Download the installer for the template onto your MOSS development server. When you run the exe, it will unpack to c:\createddf, and you'll see a console window open saying 'Configuring Visual Studio, please wait...'. Don't delete or move the c:\createddf directory!
2) Close Visual Studio and re-open
3) Create a new project, and choose the MOSS Solution Builder Project template from the SharePoint_RF project type group. Make sure to name your project with no spaces...
4) The solution explorer should look like this once the project opens (click img to expand):
There is a temp.snk file which will be used to sign your assembly unless you change it, which you should.
5) Build the project
7) Open ManifestTemplate.xml
- The solution guid is unique for this solution
- This file is your handle on having control over what's in the manifest.xml file in the wsp. If you want other namespaces to be included in the safe controls section, put them in. The same rules apply as in the previous wsp packaging tool I created earlier.
8) Open the deploy.cmd file in the DeploymentScripts directory. Change the SITE_URL variable to be the address of the web application you want to deploy the solution to.
9) Navigate to the DeploymentScripts directory in Windows Explorer, and double-click deploy.cmd. Make sure you have the stsadm directory added to your path environment variables. You could also create an external tool in Visual Stuido so you never need to leave the IDE.
The first time you run the deploy.cmd, you might see an error saying that the solution does not exist in the solution store. Just hit enter. The deploy.cmd tries to delete, then add, then deploy the solution. You can tweak the file so that features are activated, as well. There's an upgrade.cmd for upgrading your solution, as well. Just make sure you remember to change the SITE_URL variable.
If you have any questions, please ask.
Enjoy!
Update (10/18/2007)
Released a newer version of the template, here's some of the updates:
1) I took out the sample pages from the layouts directory because I wasn't able to achieve exactly what I was trying to do. Essentially, I was trying to demonstrate how to have ASPX and ASCX files with code behind, but I just didn't like how it was sitting in the template. I explain how to do the same thing in my post on
deploying a site definition as a feature, and
Andrew Connell explains how to on his blog, too.
2) The ManifestTemplate.xml file was changed so that you no longer need to worry about putting the public key token into the file. The [ThisAssemblyName] placeholder in the file is replaced with the correct information when you build the project after you sign it. Once you sign the project, you need to build the project twice, as the signing process takes too long, and the assembly full name isn't yet available. Once it is, you can build it normally from then on.
3) You don't need to worry about adding features to the FeatureManifest section in ManifestTemplate.xml. In fact, you don't need a FeatureManifest section in ManifestTemplate at all. Custom features in the Features directory of the project will have their feature.xml files added to the manifest.xml output by the build. If you don't want a feature included in the manifest, add '.exclude' to the custom feature's directory name.
4) If you want other assemblies included in the wsp, like non-GAC'd assemblies or 3rd party assemblies, you can add them to the Assemblies directory in your project. They will get added to the root of the wsp, but you need to add the appropriate assembly lines in the ManifestTemplate.xml file.
Support for Visual Studio 2008:
Execute InstallWSPBuilder.exe in c:\createddf via command line, but add the parameter '/2008'. This will set up the template in VS08.