Deploying a BCS Model to another Environment

In this handy guide we will show you how you can move your BCS Model (and any other WSP) from one environment to another. One of the great advantages of the new SharePoint project types in Visual Studio 2010 is that fact that the packaging of your WSP (SharePoint Solution Package) is done for you.

As Developers we should be working on our own development SharePoint environment, typically this is running on a VPC. The great benefit of this is that if we write some not-quite-as-efficient-as-it-could-be code then it will only effect that one VPC rather than any live servers. The other main advantage is that if you get an irreversible problem then you can just revert back to a snapshot (which you have taken!) and you can continue on your way, this time avoiding making that same mistake!

The question we are dealing with here is that once you have developed your Web Part, BCS Model, Application Page etc on the Development VPC how do you get that artefact onto the next environment – the Staging Environment.

Walkthrough

  1. Once you have tested debugged as much as you can on your Development Environment..
  2. Here we need to check that any dependency on your Development Environment are removed or updated for the next deployment. One example of this is the Site URL. Left click on the Project and in the properties you will see the SiteUrl – make sure this Url is valid for the next environment.

    SiteUrl for Development Environment

    so here we need to update the Site URL

    SiteUrl for Staging Environment

  3. Right click on your Project and choose ‘Build’, and then do the same but choose ‘Package’
  4. Right click on your Project and choose ‘Open Folder in Windows Explorer’
  5. Within the binDebug or binRelease (depending on your configuration) you will find the *.wsp , this is the file (actually a cab file) which contains all of the elements.xml, manifest.xml etc which was configured in Visual Studio

    Packaged WSP

  6. Copy this file to your next environment, in my case it’s my SharePoint Staging Environment
  7. You can now use either STSADM or PowerShell to do deploy to this new environment just like you would any other WSP.

Deploying WSP using STSADM

  1. Open a command prompt in the bin folder of the SharePoint root:

    ”C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14BIN”

    from this path you can run STSADM

  2. To add the solution run the following command

    stsadm -o addsolution -filename pathSolutionName.wsp

    This basically calls the add solution command passing in the path of the WSP to add to the Solution Store

    Stsadm deployment

    You will see ‘Operation Completed Successfully’

  3. Next  you should open up Central Administration
  4. go to ‘System Settings’ > ‘Manage Farm Solutions’
  5. We can see our solution is not deployed

    Solution not deployed

  6. Click on the solutions name
  7. Click ‘Deploy Solution’
  8. Configure the deployment settings and click ‘OK’

    Solution configuration

  9. The solution is now deployed and ready to use

    Solution deployed

Deploying WSP using PowerShell

  1. Run the SharePoint 2010 Management Console located in your Microsoft SharePoint 2010 Products folder from your start menu
  2. Run the following command

    Add-SPSolution pathSolutionName.wsp

    ps

  3. follow steps 3 from the STSADM guide above

With both the STSADM and the PowerShell it is possible to script the deployment, installation and activation through the commands rather than using the Central Administration interface as described here.

<Phill />

Leave a comment