Gerald de Run's Blog

  • SharePoint Visual Studio Project and Deployment Templates

    I started using the SharePoint Visual Studio Project Templates from CodePlex and extended the original solution to:

    • Use seperate SharePoint Project and SharePoint Deployment templates; this supports packaging multiple SharePoint Projects (assemblies and artifacts) into a single SharePoint Deployment Package (.wsp file).
    • Modified scripts that generate the manifest.xml and cab.ddf to support packaging additional SharePoint Artifacts (site definitions, root files).

    Using these templates on several of my customer engagements has gotten their development teams into the habit of packaging their SharePoint solution properly for deployment.  I have attached the templates and an example using code samples from Inside Microsoft Windows SharePoint Services 3.0.

    SharePoint Project Template 

    The SharePoint Project template mimics the 12 hive folder structure for working with SharePoint artifact files.  I used 12 as the root folder because certain SharePoint artifact files may live outside the TEMPLATE folder (eg. Resources).
    12
    |--TEMPLATE
       |--FEATURES
       |--...
    |--Resources

    I find working with the 12 hive structure far more intuitive than using the Visual Studio 2005 Extensions for Windows SharePoint Services that also does not provide complete control over the generated solution package.  I have used my templates to re-package the code samples from Inside Microsoft Windows SharePoint Services 3.0.

    The DLLS folder structure is used for deploying the compiled assembly to the Web Application BIN directory or the Global Assembly Cache and defining <SafeControl> and <CodeAccessSecurity> settings in Web.config for the assembly.
    DLLS
    |--CodeAccessSecurity
    |--GAC
    |--SafeControls

    • DLLS: compiled assemblies copied to this folder will be packaged for deployed to the Web Application BIN directory by the SharePoint Deployment project.
    • CodeAccessSecurity: Contents of <CodeAccesSecurity>.xml files in this folder will be added to the solution manifest by the SharePoint Deployment project.
    • GAC: compiled assemblies copied to this folder will be packaged for deployed to the Global Assembly Cache by the SharePoint Deployment project.
    • SafeControls: Contents of <Assembly>.dll.xml files in this folder will be added to the solution manifest by the SharePoint Deployment project.

    The SharePoint Project template contains a Post-build event command-line to:

    1. Optionally copy the project output to the DLLS or GAC folder.
    2. Copy the 12 and DLLS folder structure to a SharePoint Deployment project path.

    Please review Readme First for how to configure the project template.

    SharePoint Deployment Template 

    The SharePoint Deployment template contains 2 scripts to automate generation of the solution manifest (manifest.xml) and solution package (.wsp):

    • CreateManifest.vbs: This script creates the solution manifest file by enumerating the 12 and DLLS folder structures.
    • CreateCabDDF.vbs: This script creates the DDF file used to generate the solution package.

    The Scripts folder contains deployment scripts that call the Stsadm command-line tool to deploy, upgrade and retract the solution package.  These deployment scripts can be extended to perform additional installation / un-installation tasks required by the solution (e.g. create new site collection using site definition deployed by the solution package).

    The SharePoint Deployment template contains a Post-build event command-line to:

    1. Clean-up project output directory; output of SharePoint Deployment is .wsp and deployment scripts.
    2. Execute CreateManifest.vbs to generate solution manifest file (manifest.xml).
    3. Execute CreateCabDDF.vbs to generate DDF file (cab.ddf).
    4. Run makecab.exe to generate the solution package (.wsp).
    5. Copy the deployment scripts to project output directory.

    Please review Readme First for how to configure the project template.

  • Scripting of SharePoint Configuration

    During setup of MOSS/WSSv3 the SharePoint Products and Technologies Configuration Wizard is run to create a new configuration database and establish a new server farm, or connect to an existing configuration database joining the server to an existing farm.  There is a command line version of the configuration wizard called PSConfig.exe.  This binary can be found in %rcommonprogramfiles%\Microsoft Shared\Web server extensions\12\BIN.

    The command line version of the configuration wizard can be used together with the Stsadm command-line tool to perform an unattended installation and configuration of MOSS/WSSv3. 
    I wrote four command-line scripts that call PSCONFIG.EXE and STSADM.EXE to automate provisioning / un-provisioning of a Server Farm and Shared Services Provider:

    • MOSSInstall.cmd - Provisions a new server farm.
    • MOSSUninstall.cmd - Un-provisions an existing server farm.
    • SSPInstall.cmd - Provisions a new shared services provider.
    • SSPUninstall.cmd - Un-provisions an existing shared services provider.

    The available commands for PSCONFIG.EXE are:

    PSCONFIG.EXE -cmd setup [-lcid <1033>]
    This performs SharePoint configuration setup based on the installation mode. If SharePoint is installed in a stand-alone mode, then stand-alone configuration is done.  If SharePoint is not installed in stand-alone mode, you must complete initial configuration setup by using the SharePoint Products and Technoligies Configuration Wizard windows application located in the start menu shortcut.

    lcid: The LCID that specified the SharePoint installation language

    PSCONFIG.EXE -cmd standaloneconfig [-lcid <1033>]
    This command will perform a SharePoint stand-alone configuration.

    PSCONFIG.EXE -cmd configdb
            [-create]
            [-disconnect]
            [-connect]
            [-server <SqlServerName>]
            [-database <SqlDatabaseName>]
            [-dbuser <value>]
            [-dbpassword <value>]
            [-user <Domain\User>]
            [-password <Password>]
            [-addomain <value>]
            [-adorgunit <value>]
            [-admincontentdatabase <SqlAdminContentDatabaseName>]
    Creates, connects, or disconnects this server from the server farm.

    • Create: Creates a new configuration database and thus establishes a new server farm.  If this server is already connected to a configuration database, the server will be disconnected first, then the new configuration database will be created.
    • Disconnect: Disconnects this server from the configuration database and this disconnects this server from the server farm.
    • Connect: Connects to an existing configuration database and thus joins this server to an existing server farm.  If this server is already connected to a configuration database, the server will be disconnected first, then connected to the existing configuration database.
    • Server: The SQL server where the configuration database is located.
    • Database: The configuration database name.
    • Dbuser: The SQL Server user name used for SQL authentication.
    • DBpassword: The SQL Server password used for SQL authentication.
    • User: Server farm administrator user account.
    • Password: Server farm administrator user account password.
    • Addomain: Active Directory domain name used for the server farm.
    • Adorgunit: Active Directory organization unit name used for the server farm.
    • Admincontentdatabase: The Central Administration Web Application content database name.

    PSCONFIG.EXE -cmd helpcollections -installall
    This command manages help collections.

    installall: Installs all available help collections.

    PSCONFIG.EXE -cmd secureresources
    This command will perform SharePoint resource security on this server.  For example, security is enforced on files, folders and registry keys.

    PSCONFIG.EXE -cmd services
            [-install]
            [-provision]
    This commnd can be used to manage SharePoint services

    • Install: Register the SharePoint services in the server farm that are located on this server.
    • Provision: Provisions the SharePoint services that are located on this server and sets the services as online if SharePoint is installed in stand-alone mode.  Provisioning services will also ensure that they are registered.

    PSCONFIG.EXE -cmd installfeatures
    This command will register the SharePoint features in the server farm that are located on this server.

    PSCONFIG.EXE -cmd adminvs
            [-provision]
            [-unprovision]
            [-port <8080>]
            [-windowsauthprovider <enablekerberos | onlyusentlm>]
    This command manages the SharePoint Central Administration Web Application on the local machine.

    • Provision: Provisions the SharePoint Central Administration Web Application on this server.  Provisioning will create a new SharePoint Central Administration Web Application virtual server and an application pool running under the server farm administrator's account.
    • Unprovision: Unprovisions the SharePoint Central Administration Web Application from this server.  Unprovisioning will remove the SharePoint Central Administration Web Application virtual server and its application pool.
    • Port: The SharePoint Central Administration Web Application port is a global setting to the server farm.  When changing the port, a SharePoint Timer service job will be dispatched to synchronize the port for all SharePoint Central Administration Web Applications in the server farm.  If a port is not specified, the port used for existing SharePoint Central Administration Web Applications in the server farm will be used.  If a SharePoint Central Administration Web Application has not been provisioned in the server farm, then the default port chosen will be random if a port is not specified.
    • Windowsauthprovider: The SharePoint Central Administration Web Application authentication provider is a global setting to the server farm.  When changing the authentication provider, a SharePoint Timer service job will be dispatched to synchronize the provider on all SharePoint Central Administration Web Applications in the server farm.  If onlyusentlm is specified, NTLM will be the exclusive authentication provider for all SharePoint Central Administration Web Applications.  All other authentication providers will be disabled and NTLM will be the only authentication provider allowed.  If enablekerberos is specified, Kerberos authentication will be enabled for all SharePoint Central Administration Web Applications.  If an authentication provider is not specified, the provider used for existing SharePoint Central Administration Web Applications in the server farm will be used.  If a SharePoint Central Administration Web Application has not been provisioned in the server farm, then the Kerberos authentication provider will be enabled if an authentication provider is not specified.

    PSCONFIG.EXE -cmd upgrade
            [-wait]
            [-reghostonupgrade]
            [-finalize]
            [-inplace <v2v | b2b>]
            [-sidebyside]
    This performs a SharePoint upgrade.  This command is automatically executed when running the SharePoint Products and Technologies Configuration Wizard if SharePoint needs to be upgraded.

    • Wait: If specified, the SharePoint Products and Technologies Configuration Wizard does not return until upgrade completed.  If not specified, the wizard returns after dispatching a SharePoint Timer service job to perform upgrade.  You can view the upgrade job status by accessing the SharePoint Central Administration Web Application using your Web browser.
    • Reghostonupgrade: If specified, the SharePoint Products and Technologies Configuration Wizard will revert all content streams during the upgrade.
    • Finalize: If specified, the SharePoint Products and Technologies Confiuration Wizard will finalize the current upgrade.  You will not be able to undo this action.
    • Inplace: If specified the SharePoint Products and Technologies Configuration Wizard will perform an in-place upgrade.  If v2v is chosen, then an in-place version to version upgrade will be performed.  If b2b is chosen, then an in-place build to build upgrade will be performed.
    • Sidebyside: If specified, the SharePoint Products and Technologies Wizard will perform a gradual upgrade.

    PSCONFIG.EXE -cmd evalprovision -provision [-port <80>]
    This performs stand-alone mode provisioning on this server.

    • Provision: Performs stand-alone mode provisioning on this server.
    • Port: The port number assigned to the default SharePoint Web Application.  If not specified, then port 80 is used.  If a SharePoint Web Application already exists using the port, the existing site will be overwritten.  If an existing site is using the port and is not a SharePoint Web Application, the site will be disabled and a new SharePoint Web Application will be created using the port.

    PSCONFIG.EXE -cmd applicationcontent -install
    This command manages shared application content.

    • Install: Copies shared application data (i.e. resource files, Web application binaries) to existing Web Application virtual directories.

    PSCONFIG.EXE -cmd quiet
    This command runs the SharePoint Product and Technologies Configuration Wizard in quiet mode.  Output is written to PSCONFIG.EXE_MM_DD_YYYY_HH_MM_SS_MS.log

  • Gerald's First Posting

    Hello World, Today I created this blog to start blogging on SharePoint and other related technologies.  I have gained a lot of useful tips and knowledge from other bloggers and would like to share my experiences too.  Thanks all, Gerald.

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker