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.
- Once you have tested debugged as much as you can on your Development Environment..
- 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.
so here we need to update the Site URL
- Right click on your Project and choose ‘Build’, and then do the same but choose ‘Package’
- Right click on your Project and choose ‘Open Folder in Windows Explorer’
- 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
- Copy this file to your next environment, in my case it’s my SharePoint Staging Environment
- 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
- 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
- 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
You will see ‘Operation Completed Successfully’
- Next you should open up Central Administration
- go to ‘System Settings’ > ‘Manage Farm Solutions’
- We can see our solution is not deployed
- Click on the solutions name
- Click ‘Deploy Solution’
- Configure the deployment settings and click ‘OK’
- The solution is now deployed and ready to use
Deploying WSP using PowerShell
- Run the SharePoint 2010 Management Console located in your Microsoft SharePoint 2010 Products folder from your start menu
- Run the following command
- 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.