Posted at: 11:40 on 17 March 2010 by Muhimbi
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:
- Part 1 – Introduction / Problems installing the existing 2007 version on SP2010
- Part 2 – Reconfiguring the Visual Studio Solution
- Part 3 – Programmatic / visual changes
- Part 4 – Updating deployment scripts (This post)
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:
- Detect which version of SharePoint is installed.
- Adjust the STSADM path accordingly.
- 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.
.
Labels: Articles, News, PDF Converter, SP2010, Workflow
1 Comments:
great article. Would be good to have a working version of the vs.net project. Even if you strip out your core class that contains the unique IP - it will help us get started.
By
Mr X, At
15 September, 2011 05:19
Post a Comment
Subscribe to Post Comments [Atom]