sharepointdeploymentsharepoint-2010wsp

SharePoint Deployment using WSP


I am looking for best practices for deploying frequent custom code changes to SharePoint 2010 server, my changes include all kind of changes like web parts, content types, workflows, feature receivers, pages images and scripts in layouts folder etc. So far what I have found in documentation is that WSP packages are recommended for deployments for SharePoint. I have few questions regarding frequent code changes using WSP packages

  1. Do we need to retract a WSP package before installing updated WSP package? What happens to previous code deployment through this package. Do we need to keep all previous changes in wsp package, so that when we retract and remove old version we get all code changes from previous version and new version.
  2. Keeping all the code changes in wsp package through various deployments can cause issues in case we have content type and list instances included in the package, how to manage this kind of changes?
  3. If we make new wsp packages for each iteration of changes, wont it clog my server with a a lot of wsp packages, one for each code change cycle?

Solution

  • Ill try to answer your questions:

    1. yes and no. if you are deploying assembly code changes then you can retract the solution without deactivating any features. This will update the assemblies in the GAC. If you need to update resources in the features like content types etc, you will need to deactivate / activate feature.

    2. What I have started to do to mitigate this problem is all my wsp provision all my content trough code, no xml for content types, list instances, etc. Then what I do Is I keep track of the current version of my feature (using web.Properties bag or something). Anytime I activate the feature I check the current version and run the appropriate code for that version. So in feature activated I have something like:

      var version = //get version here from property bag or list etc
      
      if (version < 1.2){ 
          provisioFinanceContentType();
          createFinanceList();
      }
      
      else if (version <1.3)
      {
            //etc.
      }
      version = 1.3
      //persist version to storage
      
    3. Do not create new WSPs use the revision system described above