How solution deployment has changed development with SharePoint technologies


Background:


Anyone who is familiar with development & deployment of custom solutions on SharePoint Portal Server 2003 or Windows SharePoint Services will probably agree when I say there are certain areas lacking in the end to end process.


For example, here is a high level generic step by step process that usually happens:



  1. Spec written (some people seem to think this step is optional)
  2. Developer develops code etc… Usually on a stand-alone, single server SharePoint environment. (I personally use a VPC for all development these days)
  3. Developer packages code into an installer if you are lucky
  4. Testing
  5. Hand off to production people who go and install it on the server(s).

This would normally be really easy right? Well, in SharePoint land there are many areas where “things” need to be done during an installation. Some of these are (but not limited to):



  • Assembly deployment. GAC or BIN
  • Web.config changes. Additions to the safe controls list, CAS security policies,
  • Resource files like images,
  • Dwp files
  • Site definitions (list definitions etc…)

Depending on how your development team packaged these would depend on how much work you had to do to deploy them.


To make matters worse, depending on your physical SharePoint farm you might need to do install steps on each server. This brought in complexity around what servers had what versions at what time etc… A nightmare if you were managing a large farm with many servers.


How we make this better in MOSS and WSSv3:


In MOSS we have a good solution to all of this called the Solution Framework. Here is a little summary about what this is:


“The Windows SharePoint Services (WSS) solution framework provides a way to bundle together all of the components for extending SharePoint in a new file called a solution file (a CAB-based format with a WSP extension). A solution is a deployable, reusable package that can contain a set of features and site definitions, templates, Web Parts, and assemblies that you can apply to a site, and individually enable or disable.” – WSS SDK


Not only this but the Solution Framework takes care of deploying the solution to ALL front end web servers in the farm without the admin having to go to each box to do this manually!


You can:



  • Deploy the Solution package to the farm
  • Retract the Solutions package
  • When a new web server is added, automatically deploy the solution to it
  • Deploy new versions of the Solution

Practical example:


In the system I talked about in “Application Development on MOSS & WSSv3” we are using a Solution package to deploy:



  • A custom Site Definition
  • 6 Feature Definitions (another new MOSS technology) that are:

    • Custom Workflows x2
    • Timer Job
    • Content Type
    • Custom List definition
    • Custom Site Columns definition

  • Web part

    • SafeControls list entry

Note: I won’t talk about Features or how to create them; Todd has a good post on that subject here: http://www.sharepointblogs.com/tbaginski/archive/2006/06/02/8062.aspx


[Updated] This means when we want to deploy this solution to a new farm we simply use the STSADM -addsolution -filename <path to solution file here> to upload the solution to the farm.  Once uploaded you can simply to into the “Solution management” section under the “Operations” tab in the Central Administration Site, and deploy that solution.




Once it is uploaded we can then choose to Deploy that solution.




This gives you options on when you want the deployment to take place and to what web applications. (In the shot above I had an assembly being deployed to the GAC, hence the warning)


Although all this will be/is documented in the WSS SDK, I thought I quickly go over how to make a solution file.


Consists of:



  • A CAB file containing

    • A Manifest.xml file
    • All the files for the Features etc… that make up your solution

Below is a cut down sample XML manifest.xml file for the example I used above (highlighted text is comments):


<?xml version=”1.0″ encoding=”utf-8″ ?>
<Solution xmlns=”http://schemas.microsoft.com/sharepoint/” SolutionId=”{79d1a62e-3627-11db-963e-00e08161165f}” ResetWebServer=”TRUE”>


    <Assemblies>
        <Assembly DeploymentTarget=”GlobalAssemblyCache” Location=”Foo.Sharepoint.Webparts\Foo.SharePoint.WebParts.dll”>
            <SafeControls>
                <SafeControl Assembly=”Foo.Sharepoint.Webparts, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=63cce650e8605f5d” Namespace=”Foo.Sharepoint.Webparts” TypeName=”*”/>
            </SafeControls>
        </Assembly>
        <Assembly DeploymentTarget=”GlobalAssemblyCache” Location=”Foo.Sharepoint.Timer/Foo.Sharepoint.Timer.dll”/>
    </Assemblies>



    <FeatureManifests>


        <FeatureManifest Location=”Foo.Sharepoint.Timer\Feature.xml”/>


        <FeatureManifest Location=”Foo.CustomType\Feature.xml”/>


        <FeatureManifest Location=”Foo.FooLibrary\Feature.xml”/>


        <FeatureManifest Location=”Foo.Columns\Feature.xml”/>


        <FeatureManifest Location=”Foo.Workflow.ProcessFoo\Feature.xml”/>


        <FeatureManifest Location=”Foo.Workflow.ProvisionFoo\Feature.xml”/>


    </FeatureManifests>


    <SiteDefinitionManifests>
        <SiteDefinitionManifest Location=”FOO”>
            <WebTempFile Location=”1033\XML\WEBTEMPFoo.XML”/>
        </SiteDefinitionManifest>
    </SiteDefinitionManifests>
</Solution>


Then you package this up along with all your Feature files into a CAB file with a “.wsp” extension. In short each feature goes into a sub-dir in the CAB that matches the path you have in the Manifest.xml file.  You can use cabmake.exe to do this, or any other tool you like.


Then you are ready to go and deploy!


Although this is probably a little more work to begin with, your deployment team will thank you for it immensely.


-Chris.


 

Comments (44)

  1. Eric Cherng says:

    Great post Chris.

    Is this the recommended way to deploy webparts now? I was going to create an MSI to handle installing to GAC and updating web.config, but this seems to take care of all that already. Would this also enable the webpart in the gallery or does the user still have to manually do that per site?

    Also, what if my Solution Management screen has nothing in it? I don’t see the toolbar on my page that is visible in your screenshot? Take a look at this screenshot: http://blogs.vertigosoftware.com/photos/ericc/images/3599/original.aspx

    Thanks.

  2. chjohn says:

    Hi Eric,

    Sorry i had a mistake in my post.  Please see the [updated] section.  Sorry.

    Yes, this is the prefered method for deployment of web parts as it has many more capabilities than the web part packaging method of deployment.  The old method will still work however 🙂

    -Chris.

  3. Adrian says:

    How do we deploy to the ISAPI folder for web services?? Does this method provide us with a way to deploy web services ??

  4. chjohn says:

    Hi Adrian,

    Your best bet for deploying web services is to deploy to the _layouts directory.  That is if you want the web service to be like the other web services that are available under each site. e.g. http://server/sites/sitename/_layouts/MyApp/MyWebServices.asmx  I have used this in the past quite a bit.  If you do the above then it is a seperate web application that you are deploying so you will need to go into IISManager and make it a web application under the _Layouts directory.  This means you wont be able to deploy a web service like this with teh solution deployment packages.

    Chris.

  5. Sezai's Blog says:

    This is obsolete after Beta 2 Technical Refresh.

    Check out these blogs instead, package your customisations…

  6. find here How solution deployment has changed development with SharePoint technologies, i really like…

  7. Hugo says:

    Hi Chris,

    Here you show us how you deploy dll and safecontrol in web.config but where is your .dwp or .webpart file in your manifest.xml ?

    I try to deploy a webpart thanks wsp but it doesn’t work.

    Thks for your answer.

    Regards.

    Hugo

  8. chjohn says:

    Hi Hugo,

    DWP files need to be deployed into the web part gallery of the site collection you want them to show up in.  You can do this using the site siettings page, or you can add the DWP file to your site template & in ONET add it as a file that gets deployed into the web part gallery.

    -Chris.

  9. No blog do Chris Jonhson, &eacute; feita a introdu&ccedil;&atilde;o &agrave; Solution Framework, a nova

  10. In the first part of this serie on SharePoint Solution Generator I just went through the creation of

  11. Thanks to those of you who partipated in my SharePoint Connection basic and advanced Deployment talks

  12. There have been a bunch of questions lately around Global Deployments. Here are some essential resources

  13. Hi all, I will be posting this as an article as well, with a link available from the front page. That

  14. Architecture, Installation, and Migration · Planning and Architecture for MOSS 2007 (large Whitepaper,

  15. Gary says:

    Can anybody here figure me out how to deploy an aspx page to the the TEMPLATELAYOUTS directory via the solution package? Thanks.

  16. Gary says:

    Can anybody here figure me out how to deploy an aspx page to the the TEMPLATELAYOUTS directory via the solution package? Thanks.

  17. En me balandant sur le forum SharePoint, je suis tombé sur une personne un peu perdu dans la problématique

  18. Starting from auditing , expiration, ( information management policies ) content types , to the pivot

  19. Todd says:

    We have the need to deploy .cab files to the server via our solution deployment. However, when doing so we get an error: "Failed to extract the cab file in the solution."

    I’ve traced this down to specifically having a .cab file in the solution.

    Is there a way to work-around this problem and just have these files deployed as any other files in the solution?

  20. John A says:

    Help!  We have created and deployed a site with a custom list. Users have entered data into the list. Versions of the items (very important) have been created. We now need to make changes to the list (more importantly it’s editform, newform, etc)  How do we do this and keep the list data, and the item versions intact on the production server?

    John

  21. This post describes an issue we were having using the SharePoint PageFieldFilter webpart in combination

  22. Stark says:

    How easy is it to replace existing deployed web-parts with say an updated version?

    Also, what do you recommend i use as test-bed when developing web parts for moss2007?

  23. how WSP files are deployed into your sharepoint 2007 farm

  24. waltzingandy@yahoo.com says:

    I’m trying to work out if it’s possible to use the Solution deployment to deploy a shared DLL to that GAC that is contained in 2 different Solution packages? The deployment itself seams to work just fine for both, but if you retract one of the two solutions, then it removes the shared DLL from the GAC – not good:)

    Thanks.

  25. I’ve had a large number of emails from .NET developers who want more information about SharePoint Development.

  26. Die Windows SharePoint Services 3.0 Infrastruktur sieht vor, dass SharePoint Erweiterungen (Web Parts,

  27. minsou says:

    Yeaah, i love solution deployment !

  28. Initially when I first created a webpart for Sharepoint/WSS, I was kind of confused with the number of

  29. Deepti says:

    Hi,

    I have a question.It might be a dumb one but I really want to know.

    After deploying a webpart through a solution package to a WSS site how can I add the web part to one of teh pages in the site. I cant trace where in the site is the wsp or deployed webpart available.

  30. Michal Bojko says:

    there is a document that gathers deployment methods for most common types of solutions like webparts, workflows, lists and infopath forms + how to package them with differen tools. maybe it will be useful to someone:

    http://www.starsoft.com.pl/files/Starsoft%20SharePoint%20Competencies%20Center%20-%20MOSS%202007%20-%20Deployment%20&%20Packaging%20guide.pdf