Blog Post

Porting a SharePoint 2007 WSPBuilder Solution to SharePoint 2010 — Part 4

Clavin Fernandes
Illustration: Porting a SharePoint 2007 WSPBuilder Solution to SharePoint 2010 — Part 4

In the final part of our series about porting a SharePoint 2007 based WSPBuilder project to SharePoint 2010 we discuss the changes made to our Installation scripts in order to make it work with both versions of SharePoint.

Please note that this article is based on our experiences with the beta version of SharePoint 2010. Some of the issues we have identified may have been resolved in the final release.

The following posts are part of this series:

Installation Script

The installation scripts used for deploying the SharePoint part of our solutions are simple Windows CMD scripts. Our customers appear to prefer it this way as it allows them to see what is going on and make necessary amendments to deploy the software as part of a larger deployment script. Unfortunately we cannot use PowerShell as that technology is not available on all systems.

In order to make the same script work on SharePoint 2007 as well as 2010 environments we have had to make the following changes:

  1. Detect which version of SharePoint is installed.

  2. Adjust the STSADM path accordingly.

  3. Adjust the name of the WSP file accordingly as the WSP files for both environments are different.

The resulting installation script is as follows:

@echo off

echo *******************************************************************************

echo Installing Muhimbi PDF Converter for SharePoint.       (c) 2010 www.muhimbi.com

echo *******************************************************************************

echo.

REM ** Detect which version of SharePoint is installed.

SET STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"

SET SolutionWSP=Muhimbi.PDFConverter.SP2010.wsp

if exist %STSADM% goto endVersionDetection

    SET STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE"

    SET SolutionWSP=Muhimbi.PDFConverter.wsp

    if exist %STSADM% goto endVersionDetection

    echo - SharePoint does not appear to be installed on this server.

    goto endOfScript

:endVersionDetection

echo - Adding solution to Solution Store

%STSADM% -o addsolution -filename %SolutionWSP%

%STSADM% -o execadmsvcjobs

echo - Deploying solution

%STSADM% -o deploysolution -name %SolutionWSP% -immediate -allowgacdeployment -force

%STSADM% -o execadmsvcjobs

echo - Feature is self activating

echo - Deploying Resources

%STSADM% -o copyappbincontent

echo - If you are experiencing problems when accessing the solution then

echo   please read the Administration guide, particularly section 3.5.

echo - Installation finished.

:endOfScript

echo.

pause

Un-Installation Script

The changes required to the un-installation script are similar to the changes for the installation script. As the name of the Timer Service has changed between SharePoint 2007 and 2010 this name has been made dynamic as well.

The resulting script is as follows:

@echo off

echo *******************************************************************************

echo Un-installing Muhimbi PDF Converter for SharePoint.    (c) 2010 www.muhimbi.com

echo *******************************************************************************

echo.

REM ** Detect which version of SharePoint is installed.

set STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\14\bin\STSADM.EXE"

set TimerServiceName="SharePoint 2010 Timer"

SET SolutionWSP=Muhimbi.PDFConverter.SP2010.wsp

if exist %STSADM% goto endVersionDetection

    SET SolutionWSP=Muhimbi.PDFConverter.wsp

    set STSADM="%CommonProgramFiles%\Microsoft Shared\Web Server Extensions\12\bin\STSADM.EXE"

        set TimerServiceName="windows sharepoint services timer"

    if exist %STSADM% goto endVersionDetection

    echo - SharePoint does not appear to be installed on this server.

    goto endOfScript

:endVersionDetection

SET SolutionWSP="Muhimbi.PDFConverter.wsp"

echo - Retracting solution.

%STSADM% -o retractsolution -name %SolutionWSP% -immediate

%STSADM% -o execadmsvcjobs

echo - Wait for the solution to be retracted across the farm (Check Central Admin).

pause

echo - Removing solution from Store.

%STSADM% -o deletesolution -name %SolutionWSP%

%STSADM% -o execadmsvcjobs

echo - Restarting timer service in order to release any GAC DLLs.

net stop %TimerServiceName%

net start %TimerServiceName%

echo - Un-installation finished.

:endOfScript

echo.

pause

That’s it. We hope you have enjoyed this series. Please leave feedback if you have any questions.

Author
Clavin Fernandes Developer Relations and Support Services

Clavin is a Microsoft Business Applications MVP who supports 1,000+ high-level enterprise customers with challenges related to PDF conversion in combination with SharePoint on-premises Office 365, Azure, Nintex, K2, and Power Platform mostly no-code solutions.

Explore related topics

Share post
Free trial Ready to get started?
Free trial