Home Development, Tools Moving SharePoint solutions from VSeWSS to WSPBuilder

Moving SharePoint solutions from VSeWSS to WSPBuilder

ToolsWSPBuilder is currently one of the best tools to build SharePoint solutions and create deployment packages. Migration from VSeWSS to WSPBuilder is easy but there are some little tricks. In current posting I will show you how to move solutions from VSeWSS to WSPBuilder.

VSeWSS is great tool by idea but it causes for me heavy performance problems when I develop SharePoint solutions that contain more modules. Also I face serious performance problems when developing VSeWSS based projects on virtual machines. VSeWSS 1.3 was pretty hard to install and configure in my environments and I decided to abandon it. WSPBuilder introduces sometimes only some minor problems that are very easy to get over.

Let’s suppose we have Visual Studio solution that contains couple of web parts. Solution uses VSeWSS based SharePoint project. We don’t have VSeWSS installed on our machine but we have WSPBuilder. We will modify project file and project structure. I show you on one web part what exactly to do.

1. Modify project file

When you open VSeWSS project you get the following error message.

Error message: The project type is not supported by this installation.

Visual Studio is not able to detect project type because you don’t have VSeWSS installed on your machine. WSPBuilder uses typical class libraries and doesn’t expect any additional project types to be installed or applied to project. Now follow these steps:

  1. Click Okay. Message disappears and project is shown as disabled in Solution Explorer.
  2. Right click on project and select Edit your-project.csproj.
  3. Project file will be opened in XML-editor.
  4. Look for ProjectTypeGuids tag. It should look like this:

    <ProjectTypeGuids>{593B0543-81F6-4436-BA1E-4747859CAAE2};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>


  5. Remove first GUID and semicolon from GUIDs list:

    <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>


  6. Save project file and close it.
  7. Right click on project file and select Reload Project.
  8. Project should load now and you should see its contents in Solution Explorer.

2. Modify project structure

WSPBuilder Visual Studio project structure WSPBuilder expects project structure that is more similar to that you can find under 12-hive. You have to create also folder for your solution features and create feature files. Although VSeWSS creates feature files automatically I am not happy with it – I don’t need feature per web part in project. Usually one feature is enough.

Here is new project structure that is okay for WSPBuilder. As you can see form Solution Explorer screenshot the folder structure is same as under 12-hive.

I put all web parts in project under same feature – EventsWebParts. If you want you can also definer more than one feature per one project. WSPBuilder will handle the situation without problems.

Currently I expected that you moved existing web part definitions to your feature folder as shown on screenshot.

3. Creating Feature.xml

Let’s create now Feature.xml file. File creation process is like for any other file type in Visual Studio. Right click on your feature folder, select Add new … and then Data and XML file. Name file as Feature.xml and you are almost done.

In your feature file you must define elements and manifests locations. You can take the following example and modify it.


<?xml version="1.0" encoding="utf-8" ?>

<Feature xmlns="http://schemas.microsoft.com/sharepoint/"

         Id="YOUR-GUIDE-HERE"

         Title="Feature title"

         Description="Feature description"

         Scope="Site"

         Hidden="FALSE">

 

  <ElementManifests>

    <ElementManifest Location="EventsWebPart.xml" />

    <ElementFile Location="EventsWebPart.webpart"/>

 

    <ElementManifest Location="PastEventsWebPart.xml" />

    <ElementFile Location="PastEventsWebPart.webpart"/>

  </ElementManifests>

</Feature>


 

4. Modifying web part files

If you are using web part definitions created by VSeWSS you need to modify files with .webpart extension. Open some of these files in Visual Studio. You should see something like this.


<?xml version="1.0" encoding="UTF-8"?>

<webParts>

  <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">

    <metaData>

      <type name="HERE IS GUID" />

      <importErrorMessage>Cannot import Web Part.</importErrorMessage>

    </metaData>

    <data>

      <properties>

        <property name="Title" type="string">Web part title</property>

        <property name="Description" type="string"></property>

      </properties>

    </data>

  </webPart>

</webParts>


Take a look at type tag under metaData. There is GUID of web part that this file defines. The same GUID is assigned to web part in its code file. When you build solution package with VSeWSS then VSeWSS replaces this GUID automatically with web part’s full type name. WSPBuilder is not able for that currently, so you have to replace the GUID in web part file with web part’s full name.

5. Test

Now you are almost done. Build your project and deploy web part to SharePoint.

  1. Right click on project title in Solution Explorer.
  2. Select WSPBuilder –> Create Deployment Folder.
  3. WSPBuilder build solution package and generates installation scripts.
  4. Select WSPBuilder –> Deploy.
  5. WSPBuilder deploys your solution to SharePoint.
  6. Open SharePoint and try to add your web parts to some page to make sure that package was built correctly.

Epilogue

Although VSeWSS is built with good intentions it offers very basic functionality and has sometimes serious performance problems. Newest version is harder to install and configure than older versions. WSPBuilder is free and open-source utility that works very well and doesn’t cause problems in development environment. It is very easy to install and use. To save your time you should think about moving to WSPBuilder if you are not using it already.

References

Related posts:

  1. Writing build and deployment scripts for SharePoint solutions

  1. No comments yet.
  1. No trackbacks yet.
WordPress SEO fine-tune by Meta SEO Pack from Poradnik Webmastera