Export (0) Print
Expand All

An Example of Deploying a New Application

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This topic demonstrates how to deploy a new SharePoint application. It uses the Training Management application as its specific example. The two major steps are to create a WSP and an Install.bat file. SharePoint provides tools that help you accomplish both these tasks. For an overview of how to deploy a new application, see Deploying a New Application. This topic also describes how to adapt the Training Management application's Install.bat file to your own situation.

Creating the WSP File

You must create a WSP file for each application that you want to deploy to a server farm. The following procedure explains this.

To create a WSP file

  1. Build the solution.
  2. Copy all the files that must be included in the Web solution package to a temporary folder. Be sure to include the bin\debug folder.
  3. Use DDFGenerator to create the Diamond Directive File (DDF). The DDF file is a text file that contains directives for Makecab.exe to compile and compress various files and turn them into a WSP. Download the program at DDFGenerator on CodePlex.
  4. Create the WSP file based on the.DDF file. Use Makecab.exe to create the WSP.

For more information, see How to: Create an Automated Build and Deployment Solution with Team Foundation Server Team Build.

Creating the Install.bat File

After you create the WSP file, you can create the Install.bat file. This is an installation batch file. You should create an Install.bat file for each environment, such as the test environment and the staging environment. An Install.bat file makes the installation process repeatable and more efficient. If you are deploying the Training Management application, perform the steps in the procedure for both Web solution package files. The optional steps can be performed either in the batch file or through the SharePoint user interface.

To create the Install.bat file

  1. Add each WSP to the SharePoint farm solution store. For the Training Management application, add both the SharePoint feature and SharePoint workflow WSP files to the solution store. Figure 1 illustrates this.

    Ff648053.initial_deployment_steps1(en-us,PandP.10).png

    Figure 1
    Add a Web solution package to the solution store

    To add a solution to the store, include the following command in the Install.bat file.

    stsadm —o addsolution -filename ContosoTrainingManagement.wsp
    
    

    The stsadm.exe program is located on the drive where SharePoint is installed. The path is %COMMONPROGRAMFILES%\microsoft shared\web server extensions\12\bin. You must be an administrator on the local computer and have access to the SharePoint configuration database to use the Stsadm.exe command-line tool. For more information about the Stsadm.exe command-line tool, see Stsadm command-line tool (Office SharePoint Server) on TechNet.

  2. Deploy each solution and its associated artifacts to each SharePoint Web application in the SharePoint farm. For the Training Management application, deploy both the Training Management solution artifacts and the Training Management workflow solution artifacts. Figure 2 illustrates this.

    Ff648053.initial_deployment_steps2(en-us,PandP.10).png

    Figure 2
    Deploying solutions and artifacts

    To deploy a solution, include the following command in the Install.bat file.

    stsadm —o deploysolution -name ContosoTrainingManagement.wsp
    
    
  3. (Optional) Activate the features at either the site collection level or the site level. The scope should be the same as the scope of the feature. If you are using the Stsadm.exe command-line tool, the scope is defined by the —url parameter. For the Training Management site, activate the ContosoTrainingManagementSiteCollection, the ContosoTrainingManagementRegistrationApproval_v1, and theContosoTrainingManagementRegistrationApprovalAssociation_v1 features. Figure 3 illustrates activating the site collection feature.

    Ff648053.initial_deployment_steps3(en-us,PandP.10).png

    Figure 3
    Activating the site collection features


    Figure 4 illustrates activating the workflow feature.



    Ff648053.initial_deployment_steps3_workflow(en-us,PandP.10).png

    Figure 4
    Activating the workflow


    To programmatically activate features, include the following command in the Install.bat file for each feature.

    stsadm —o activatefeature -id <guid>  -url localhost
    
    
  4. (Optional) Create a new site that is based on a site definition or template. Figure 5 illustrates this.

    Ff648053.initial_deployment_steps4(en-us,PandP.10).png

    Figure 5
    Creating a new site

Figure 6 illustrates the SharePoint installation once you have deployed the application.



Ff648053.initial_deployment_steps8(en-us,PandP.10).png

Figure 6
Training Management SharePoint installation

Using the Training Management Install.bat File

You can manually create the Install.bat file from the steps that are described in Creating the Install.bat File or you can use the file from Training Management application as a template. The Training Management's batch file is designed to run from a folder on a Web front-end server. This folder needs to contain the Install.bat and Setup.bat files and the Web solution package(s). The Setup.bat file is generated by Visual Studio extensions for Windows SharePoint Services, which is located in the ..\bin\debug folder. To adapt the file to your own application, you must do the following:

  • Set the port number.
  • Set the TargetWebUrl parameter.
  • Set the TargetSiteUrl parameter.
  • Enter the name of the Web site to create. Depending on your application, you may not want to create a Web site from a batch file. If you do, omit this step.
  • If you have multiple solutions to deploy, you must modify the batch file to call each feature's Setup.bat file.
Ff648053.note(en-us,PandP.10).gifNote:
The Setup.bat file adds the Web solution package to the solution store, deploys the solution, and activates the features. This corresponds to step 1 through step 3 in Creating the Install.bat File. If you want to run the Install.bat file from a folder on a remote computer, you must change the localhost parameter to the remote computer name in both the Install.bat file and the Setup.bat file.

This is the code for the Training Management application's Install.bat file. You can use the following batch file as a starting point to build your own Install.bat file.

@echo off
setlocal

    set SPLocation=%CommonProgramFiles%\Microsoft Shared\web server extensions\12
    set SPAdminTool=%SPLocation%\BIN\stsadm.exe
    set Install=
    set Uninstall=

    set port=80
    set AppPool="SharePoint - %port%"
    set DefaultWebUrl=http://localhost:%port%
    set DefaultSiteUrl=http://localhost:%port%
    set TargetWebUrl=http://localhost:%port%/training
    set TargetSiteUrl=http://localhost:%port%


    set SPTemplateLocation=%SPLocation%\template
    set SPFeaturesLocation=%SPTemplateLocation%\features
    set SPSiteTemplateLocation=%SPTemplateLocation%\sitetemplates

    set ValidationFailed=

    echo. 
    echo.***** Resetting IIS ***********************
    iisreset

    echo. 
    echo.***** installing wsp **********************
    echo.*setup.bat /install /siteurl %TargetSiteUrl%
    call  setup.bat /install /siteurl %TargetSiteUrl%

    echo.
    echo.***** creating triaing web    *************
    echo.*%SPAdminTool%" -o createweb -url %TargetWebUrl% -sitetemplate "CONTOSOTRAINING" -title "Training Site"
    call "%SPAdminTool%" -o createweb -url %TargetWebUrl% -sitetemplate "CONTOSOTRAINING" -title "Training Site" 


    echo. 
    echo.***** Resetting IIS ***********************
    iisreset

pause

Deploying to Multiple Web Front-End Servers

If you want to deploy the application to multiple Web front-end servers, you need to modify the Setup.bat file. The following code is generated by Visual Studio extensions for Windows SharePoint Services.

echo Deploying solution %PackageName% ...
"%SPAdminTool%" -o deploysolution -name "%PackageName%" -local -allowGacDeployment -url %TargetWebUrl%

The following code is the modified code. The local parameter is replaced with immediate and the file now includes an execadmsvcjobs command.

echo Deploying solution %PackageName% ...
    "%SPAdminTool%" -o deploysolution -name "%PackageName%" -immediate -allowGacDeployment —url %TargetWebUrl%
    "%SPAdminTool%" -o execadmsvcjobs

Uninstalling Considerations

The following code is a batch file that uninstalls the Training Management application. This batch file uninstalls the existing version of the application. Run this file before you install a new version.

Because the Uninstall.bat file calls the Setup.bat file that is generated by Visual Studio extensions for Windows SharePoint Services, the Uninstall.bat file must be in the same folder as the Setup.bat file.

If the uninstall batch file fails, follow the manual steps that are listed in How to: Manually Uninstall the Training Management Application.

@echo off

    set SPLocation=%CommonProgramFiles%\Microsoft Shared\web server extensions\12
    set SPAdminTool=%SPLocation%\BIN\stsadm.exe
    set Install=
    set Uninstall=
    set port=80
    set AppPool="SharePoint - %port%"
    set DefaultWebUrl=http://localhost:%port%
    set DefaultSiteUrl=http://localhost:%port%
    set TargetWebUrl=http://localhost:%port%/training
    set TargetSiteUrl=http://localhost:%port%

    set SPTemplateLocation=%SPLocation%\template
    set SPFeaturesLocation=%SPTemplateLocation%\features
    set SPSiteTemplateLocation=%SPTemplateLocation%\sitetemplates

    set ValidationFailed=

    echo.    
    echo.***** resetting IIS               **********************
    call iisreset /STOP

    echo.   
    echo.***** deleting training web       **********************
    echo.*"%SPAdminTool%" -o deleteweb -url %TargetWebUrl% 
    call  "%SPAdminTool%" -o deleteweb -url %TargetWebUrl% 

    echo. 
    echo.***** uninstalling wsp            ***********************
    echo.*setup.bat /uninstall /siteurl %TargetSiteUrl%
    call  setup.bat /uninstall /siteurl %TargetSiteUrl%

    echo.    
    echo.***** resetting IIS               ***********************
    call iisreset

pause

How to: Manually Uninstall the Training Management Application

This topic explains how to use the SharePoint Central Administration to manually remove previous versions of the Training Management solution before installing a new version. You must use this procedure if the setup/uninstall command in the Uninstall.bat file is unsuccessful.

To manually uninstall the application

  1. Browse to the Training Management site.
  2. Select Site Actions.
  3. Select Site Settings.
  4. Select Site features on the Site Administration tab.
  5. Click the Deactivate button for Contoso Training Management.
  6. Select Site Actions.
  7. Select Site Settings.
  8. Select Go to top level site settings.
  9. Select Site collection features.
  10. Click the Deactivate button for Contoso Training Management.
  11. Browse to the SharePoint Central Administration Web site.
  12. Click the Operations tab.
  13. Under Global Configuration, click Solution management.
  14. Click contosotrainingmanagement.wsp.
  15. Click Retract Solution, and then click OK.
  16. Return to the Solution Management page and refresh it.
  17. Repeat step 6 until the retract operation is complete. This is when the status changes from Deployed to Not Deployed.
  18. After the status changes, click contosotrainingmanagement.wsp.
  19. Click Remove Solution.
  20. In the message confirmation dialog box, click OK.
  21. If contosotrainingmanagementregistratoinapproval_v1.wsp exists, perform step 4 through step 10.
  22. Click the Application Management tab.
  23. Under SharePoint Site Management, click Delete site collection.
  24. Select the site collection for the Training Management application.
  25. Click Delete.
  26. In the message confirmation dialog box, click OK.

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Show:
© 2015 Microsoft