0
Salaudeen Rajack [email_address] Best Practices for  SharePoint Solution Deployment
SharePoint Solution Packages <ul><ul><li>What is a solution package? </li></ul></ul><ul><ul><li>A  solution package  is a ...
Master pages, layouts, CSS, images, scripts – Developer Reference <ul><li>Into a library inside your site collection </li>...
<ul><li>Site Customizations </li></ul><ul><ul><li>Changes to one particular site recorded in content DB </li></ul></ul><ul...
Solution Life Cycle
Tools <ul><li>WSPBuilder </li></ul><ul><ul><li>Creates SharePoint Solutions files based on a folder structure </li></ul></...
Deploying SharePoint Solutions <ul><li>Add .WSP to the solution store </li></ul><ul><ul><li>Via command line using STSADM ...
Retracting SharePoint Solutions <ul><li>Retracting is removing the solution components from the servers where it was deplo...
Upgrading Solutions Stsadm –o addsolution –filename mysolution.wsp Deploy  Solution Stsadm –o upgradesolution -name mysolu...
<ul><li>Feature-based Components </li></ul><ul><ul><li>Custom Application Page </li></ul></ul><ul><ul><li>Site Page Templa...
Features <ul><li>A building block for creating SharePoint solutions </li></ul><ul><ul><li>A unit of design, implementation...
Solution deployment <ul><li>“ Featurize” your custom development </li></ul><ul><ul><li>Any SharePoint element </li></ul></...
<ul><li>This is where many of your development files need to be deployed </li></ul><ul><ul><li>Most files go into template...
Whats inside manifest.xml MyStuff.wsp manifest.xml Other Stuff Templates/components
<ul><li>Defines Solution properties and contents </li></ul>A Sample Manifest.xml file
<ul><li>Use WSP Builder (codeplex) </li></ul><ul><li>Can done using MAKECAB.EXE also </li></ul><ul><ul><li>Requires .DDF i...
<ul><li>DDF file must build proper folder structure </li></ul><ul><ul><li>Prefer  .Set DestinationDir  instruction </li></...
<ul><li>(1) Solution Package Installation </li></ul><ul><ul><li>.WSP file is copied to ConfigDB </li></ul></ul><ul><li>(2)...
<ul><li>Central Admin provides some control </li></ul><ul><ul><li>Allows you to see and deploy .WSP files </li></ul></ul><...
<ul><li>Central Admin allows some inspection </li></ul>Solution Package Properties
<ul><li>Best Practices </li></ul><ul><ul><li>Create solution-specific directory in LAYOUTS </li></ul></ul><ul><ul><li>Use ...
<ul><li>Best Practices </li></ul><ul><ul><li>Use file-based templates for page creation </li></ul></ul><ul><ul><li>Add Saf...
<ul><li>Best Practices </li></ul><ul><ul><li>Deploying custom field type using a .WSP </li></ul></ul><ul><ul><li>Avoiding ...
<ul><li>Best Practices </li></ul><ul><ul><li>Adding SafeControl entries using manifest.xml </li></ul></ul><ul><ul><li>Depl...
Web Part inside the WSP <ul><li>Do not use any code in your Web Part </li></ul><ul><li>Always load an UserControl </li></u...
Permissions <ul><li>Your code runs with permissions of the logged on user </li></ul><ul><li>Set up proper testing for Perm...
Typical batch files for Install/Retract solutions <ul><li>Install.bat </li></ul><ul><li>stsadm.exe -o addsolution -filenam...
<ul><li>Best Practices </li></ul><ul><ul><li>make sure WSP files are documented -just a few lines to tell what the solutio...
Check List <ul><li>Verify the Scope of the solutions  </li></ul><ul><li>Make sure &quot;UpgradeSolution&quot; swith is use...
Resources <ul><li>Best practices resource center for SharePoint 2007   http://technet.microsoft.com/en-us/office/sharepoin...
Shoot your queries to [email_address] Thank You!
Upcoming SlideShare
Loading in...5
×

Best practices for share point solution deployment

8,066

Published on

Best practices for share point solution deployment

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
8,066
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
169
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • http://msdn.microsoft.com/en-us/library/ms476046.aspx
  • SharePoint Customizations Versus Development
  • STSDEV is a proof-of-concept utility application which demonstrates how to generate Visual Studio project files and solution files to facilitate the development and deployment of templates and components for the SharePoint 2007 platform including Windows SharePoint Services 3.0 (WSS) and Microsoft Office SharePoint Server 2007 (MOSS). Note that the current version of the stsdev utility only supports creating projects with the C# programming language. Main strongpoint: relies on build targets not on projecttype (WSP builder and VSeWSS introduce a projecttype). Main weakness: only one dll per solution. SharePoint Installer This project is a Windows application for an eased and more user friendly installation and deployment of SharePoint 2007 solution files to a SharePoint server farm. Distribute your SharePoint solution files with this installation program instead of a raw script using STSADM.EXE to install and deploy the solution. WSP Builder The WSPbuilder is a console application that creates SharePoint Solutions files based on a folder structure. WSPBuilder will automatically traverse a &amp;quot;12&amp;quot; folder structure and creates a SharePoint solution manifest.xml and the wsp file based on the files it finds. Therefore you do not need the knowledge of how to create a solution manifest.xml and wsp file any more. VSeWSS 1.2 Windows SharePoint Services 3.0 Tools: Visual Studio 2008 Extensions STSADM http://blogs.msdn.com/ronalus/archive/2007/01/04/stsadmwin-has-an-2007-version.aspx Gary Lapointe STSADM http://stsadm.blogspot.com/ SPOperation namespace, place dll in the GAC
  • The set of features provided exclusively by Microsoft.SharePoint.WebPartPages.WebPart is as follows: Cross page connections Connections between Web Parts that are outside of a zone Client-side connections (Web Part Page Services Component) Data caching infrastructure, including the ability to cache to the database
  • Transcript of "Best practices for share point solution deployment"

    1. 1. Salaudeen Rajack [email_address] Best Practices for SharePoint Solution Deployment
    2. 2. SharePoint Solution Packages <ul><ul><li>What is a solution package? </li></ul></ul><ul><ul><li>A solution package is a distribution package that delivers your custom SharePoint Server development work to the Web servers or the application servers in your server farm. </li></ul></ul><ul><ul><li>Use solutions to package and deploy </li></ul></ul><ul><ul><ul><li>custom Features </li></ul></ul></ul><ul><ul><ul><li>site definitions, Master Pages </li></ul></ul></ul><ul><ul><ul><li>Application Pages, Custom Pages, layout pages </li></ul></ul></ul><ul><ul><ul><li>Templates, Images </li></ul></ul></ul><ul><ul><ul><li>Web Parts, User Controls </li></ul></ul></ul><ul><ul><ul><li>Cascading style sheets </li></ul></ul></ul><ul><ul><ul><li>Event Receivers, Workflow Activities, Workflow Assemblies </li></ul></ul></ul><ul><ul><ul><li>Global Resources (.resx files) </li></ul></ul></ul><ul><ul><ul><li>Policies and assemblies. </li></ul></ul></ul><ul><ul><li>WSP files are just CAB file with .WSP extension. </li></ul></ul><ul><ul><li>Templates and/or components in an installable unit </li></ul></ul><ul><ul><li>Package that contains metadata (manifest.xml) </li></ul></ul>
    3. 3. Master pages, layouts, CSS, images, scripts – Developer Reference <ul><li>Into a library inside your site collection </li></ul><ul><ul><li>Can be referenced by ~site, ~sitecollection and ~masterpage </li></ul></ul><ul><ul><li>Only available within the site collection </li></ul></ul><ul><ul><li>Too many site collection makes it harder to update these files </li></ul></ul><ul><ul><li>Updatable through the web interface </li></ul></ul><ul><li>Into the _LAYOUTS folder </li></ul><ul><ul><li>Can be referenced by path to folder </li></ul></ul><ul><ul><li>Available for every Sharepoint website in farm </li></ul></ul><ul><ul><li>One place for easy updating these files </li></ul></ul><ul><ul><li>Only updatable directly on the server </li></ul></ul><ul><ul><li>All web applications on the server share this folder </li></ul></ul>
    4. 4. <ul><li>Site Customizations </li></ul><ul><ul><li>Changes to one particular site recorded in content DB </li></ul></ul><ul><ul><li>Done using the browser or the SharePoint Designer </li></ul></ul><ul><ul><li>Easy to do but hard to reuse </li></ul></ul><ul><li>Solution Development </li></ul><ul><ul><li>Creation of reusable templates/components </li></ul></ul><ul><ul><li>Templates/components installed on Web server </li></ul></ul><ul><ul><li>Development based on Visual Studio projects </li></ul></ul><ul><ul><li>Project source files checked into source code control </li></ul></ul><ul><ul><li>Projects can be moved through staging to production </li></ul></ul>Site customizations Vs Solutions Development
    5. 5. Solution Life Cycle
    6. 6. Tools <ul><li>WSPBuilder </li></ul><ul><ul><li>Creates SharePoint Solutions files based on a folder structure </li></ul></ul><ul><ul><li>Deploy solutions </li></ul></ul><ul><li>SharePoint Installer </li></ul><ul><ul><li>Creating user friendly installation and deployments for SharePoint 2007 solutions </li></ul></ul><ul><li>VSeWSS 1.2 </li></ul><ul><ul><li>Visual Studio 2008 extensions </li></ul></ul><ul><li>STSDEV </li></ul><ul><ul><li>Generate Visual Studio project files and solution files </li></ul></ul><ul><li>STSADM </li></ul><ul><ul><li>184 operations through command line on the web server </li></ul></ul><ul><ul><li>Custom extensions possible </li></ul></ul>
    7. 7. Deploying SharePoint Solutions <ul><li>Add .WSP to the solution store </li></ul><ul><ul><li>Via command line using STSADM </li></ul></ul><ul><ul><li>Via object model </li></ul></ul><ul><li>Deploy to all or individual Web Applications </li></ul><ul><ul><li>Via Central Administration (solution mgmt) </li></ul></ul><ul><ul><li>Via Command-line </li></ul></ul><ul><ul><li>Via Object Model </li></ul></ul>Front-End Web Servers Stsadm –o addsolution –filename mypackage.wsp Solution Store stsadm -o deploysolution -name mypackage.wsp –local -url IISWebApp
    8. 8. Retracting SharePoint Solutions <ul><li>Retracting is removing the solution components from the servers where it was deployed </li></ul><ul><li>Be aware : </li></ul><ul><ul><li>Post-retracting actions can be necessary (e.g. Web Parts) </li></ul></ul><ul><ul><li>Once instances have been created from schemas (e.g. List templates), retracting a solution is not adviced. Leave the solution on the server but hide the Features making the solution components available </li></ul></ul>
    9. 9. Upgrading Solutions Stsadm –o addsolution –filename mysolution.wsp Deploy Solution Stsadm –o upgradesolution -name mysolution.wsp –filename mysolution.wsp –immediate -allowgacdeployment MySolution.wsp (v 1.0) MySolution.wsp (v 2.0) MySolution.wsp SolutionID must be the same!
    10. 10. <ul><li>Feature-based Components </li></ul><ul><ul><li>Custom Application Page </li></ul></ul><ul><ul><li>Site Page Templates </li></ul></ul><ul><ul><li>Master Pages </li></ul></ul><ul><ul><li>Web Parts </li></ul></ul><ul><ul><li>Site Columns and Content Types </li></ul></ul><ul><ul><li>Custom List and Document Library Definitions </li></ul></ul><ul><ul><li>List-based Event Handlers </li></ul></ul><ul><ul><li>Custom Workflows </li></ul></ul><ul><li>Components creating without using features </li></ul><ul><ul><li>Custom Field Types </li></ul></ul><ul><ul><li>Site Definitions </li></ul></ul>WSS Component Development
    11. 11. Features <ul><li>A building block for creating SharePoint solutions </li></ul><ul><ul><li>A unit of design, implementation and deployment </li></ul></ul><ul><li>Features can contain elements </li></ul><ul><ul><li>e.g. menu items, links, list types and list instances </li></ul></ul><ul><li>Features can contain event handlers </li></ul><ul><ul><li>You can add any code which used WSS object model </li></ul></ul><ul><li>Features can depend on other Features </li></ul><ul><li>Features can be stapled </li></ul>
    12. 12. Solution deployment <ul><li>“ Featurize” your custom development </li></ul><ul><ul><li>Any SharePoint element </li></ul></ul><ul><ul><li>Changes in your web.config </li></ul></ul><ul><ul><li>Copying files to specific web folders </li></ul></ul><ul><li>Deploy features and other assets by WSP Solution package </li></ul><ul><li>Your development machine does not go into production </li></ul><ul><li>Use a buildserver </li></ul><ul><li>Always test with different set of browsers (level 1 and level 2) </li></ul><ul><li>Watch out for rights </li></ul>
    13. 13. <ul><li>This is where many of your development files need to be deployed </li></ul><ul><ul><li>Most files go into templates directory </li></ul></ul>The Root files directory: Web Service files GLOBAL .RESX files Application Pages User Controls Features Field*.xml files Site Definitions Images Admin Pages
    14. 14. Whats inside manifest.xml MyStuff.wsp manifest.xml Other Stuff Templates/components
    15. 15. <ul><li>Defines Solution properties and contents </li></ul>A Sample Manifest.xml file
    16. 16. <ul><li>Use WSP Builder (codeplex) </li></ul><ul><li>Can done using MAKECAB.EXE also </li></ul><ul><ul><li>Requires .DDF input file </li></ul></ul>Building the .WSP file Solution Package Build Process Input DDF File MAKECAB.EXE Output WSP File
    17. 17. <ul><li>DDF file must build proper folder structure </li></ul><ul><ul><li>Prefer .Set DestinationDir instruction </li></ul></ul>DDF file – closer look MyStuff.wsp
    18. 18. <ul><li>(1) Solution Package Installation </li></ul><ul><ul><li>.WSP file is copied to ConfigDB </li></ul></ul><ul><li>(2) Solution Package Deployment </li></ul><ul><ul><li>.WSP pushed out to Web servers </li></ul></ul><ul><ul><li>Usually requires IIS Reset operation </li></ul></ul><ul><ul><li>Done in production farm in off hours </li></ul></ul>REM - Deploy Solution Package MyStuff.wsp to Web servers in farm %STSADM% -o deploysolution -name MyStuff.wsp -immediate REM – force batch file to run timer job synchronously %STSADM% -o execadmsvcjobs REM - Install CustomApplicationPages.wsp in WSS Solution Package Store %STSADM% -o addsolution -filename MyStuff.wsp REM – force batch file to run timer job synchronously %STSADM% -o execadmsvcjobs Two Phases of WSP Deployment .WSP Install WSP ConfigDB .WSP Deploy WFE WFE WFE ConfigDB WSP
    19. 19. <ul><li>Central Admin provides some control </li></ul><ul><ul><li>Allows you to see and deploy .WSP files </li></ul></ul><ul><ul><li>Does not provide a way to install .WSP files </li></ul></ul>Solution Management
    20. 20. <ul><li>Central Admin allows some inspection </li></ul>Solution Package Properties
    21. 21. <ul><li>Best Practices </li></ul><ul><ul><li>Create solution-specific directory in LAYOUTS </li></ul></ul><ul><ul><li>Use code-behind with DLL installed in GAC </li></ul></ul><ul><ul><li>Adding a complimentary feature for navigation </li></ul></ul>Application Pages - Best Practices
    22. 22. <ul><li>Best Practices </li></ul><ul><ul><li>Use file-based templates for page creation </li></ul></ul><ul><ul><li>Add SafeControl setting when using custom controls </li></ul></ul><ul><ul><li>Deploy .ascx files into CONTROLTEMPLATES </li></ul></ul><ul><ul><li>Clean up during feature deactivation </li></ul></ul>Custom Site Pages
    23. 23. <ul><li>Best Practices </li></ul><ul><ul><li>Deploying custom field type using a .WSP </li></ul></ul><ul><ul><li>Avoiding naming conflicts with .ascx files </li></ul></ul>Field Types
    24. 24. <ul><li>Best Practices </li></ul><ul><ul><li>Adding SafeControl entries using manifest.xml </li></ul></ul><ul><ul><li>Deploy feature to push .webpart files into Web Part gallery </li></ul></ul>Web Parts
    25. 25. Web Part inside the WSP <ul><li>Do not use any code in your Web Part </li></ul><ul><li>Always load an UserControl </li></ul><ul><ul><li>Use the ControlTemplates folder </li></ul></ul><ul><ul><li>Put the logic into the control </li></ul></ul><ul><ul><li>Code and design should be separated </li></ul></ul><ul><li>Put only properties in your Web Part </li></ul><ul><li>Two namespaces </li></ul><ul><ul><li>System.Web.UI.WebControls.WebParts </li></ul></ul><ul><ul><li>Microsoft.SharePoint.WebParts </li></ul></ul>
    26. 26. Permissions <ul><li>Your code runs with permissions of the logged on user </li></ul><ul><li>Set up proper testing for Permissions </li></ul><ul><ul><li>Especially for anonymous internet facing sites </li></ul></ul><ul><ul><li>I always use Firefox since it does not log me on </li></ul></ul><ul><li>Coding & Elevation </li></ul><ul><ul><li>Impersonation </li></ul></ul><ul><ul><li>SPSecurity.RunWithElevatedPrivileges </li></ul></ul>
    27. 27. Typical batch files for Install/Retract solutions <ul><li>Install.bat </li></ul><ul><li>stsadm.exe -o addsolution -filename MyListSolution.wsp </li></ul><ul><li>stsadm.exe -o deploysolution -name MyListSolution.wsp -local </li></ul><ul><li>Retract.bat </li></ul><ul><li>stsadm.exe -o retractsolution -name MyListSolution.wsp –local </li></ul><ul><li>stsadm.exe -o deletesolution -name MyListSolution.wsp </li></ul>
    28. 28. <ul><li>Best Practices </li></ul><ul><ul><li>make sure WSP files are documented -just a few lines to tell what the solution contains and what it does (makes it easier when you need to debug what caused your farm to become unstable) </li></ul></ul><ul><ul><li>make sure dependencies between WSP files are documented </li></ul></ul><ul><ul><li>require that upgrade scenarios have been thought into the features you are about to install (often this will include callout code that handles feature deactivation) </li></ul></ul><ul><ul><li>create a baseline performance indication of your farm that you update each time you deploy new solutions and features to monitor performance degradation </li></ul></ul><ul><ul><li>use batch files scripts to deploy your packages to make deployments consistent across environments (dev-test, integration-test, pre-prod, prod) </li></ul></ul><ul><ul><li>Don't accept debug mode build assemblies! </li></ul></ul><ul><ul><li>suggest developers do code review before releasing code </li></ul></ul><ul><ul><li>Make sure, your WSP has un-installation module in place. </li></ul></ul>General Guidelines
    29. 29. Check List <ul><li>Verify the Scope of the solutions </li></ul><ul><li>Make sure &quot;UpgradeSolution&quot; swith is used, when deploying next version </li></ul><ul><li>Make sure, files are deployed to the right directory </li></ul><ul><li>Verify the structure of the Manifest.xml file </li></ul><ul><li>Check for naming conflicts with files (eg. Company name - component- version) </li></ul><ul><li>Make sure WSP files are well documented. </li></ul><ul><li>make sure dependencies between WSP files are documented Don't accept debug mode build assemblies! </li></ul><ul><li>Ensure that new solutions have a unique GUID in the Farm Ensure that the new solution version number is incremented (format V#.#.#) </li></ul><ul><li>The solution package should not include any of SharePoint installed files. </li></ul><ul><li>All source code must be under a proper source control All releases, internal builds must have proper labels on source control. </li></ul>
    30. 30. Resources <ul><li>Best practices resource center for SharePoint 2007 http://technet.microsoft.com/en-us/office/sharepointserver/bb736746.aspx </li></ul><ul><li>Patterns and practices SharePoint guidance http://www.codeplex.com/spg </li></ul><ul><li>Best practices for SharePoint guidance http://msdn.microsoft.com/en-us/library/dd203468.aspx </li></ul><ul><li>SharePoint Deployment Planning Services https://iwsolve.partners.extranet.microsoft.com/SDPS/ </li></ul><ul><li>Downloadable book: Design and build sites for Office SharePoint Server 2007 http://go.microsoft.com/fwlink/?LinkId=110087 </li></ul><ul><li>Other resources such as http://www.codeplex.com / http://www.dutchsug.nl / www.microsoft.com/sharepoint </li></ul>
    31. 31. Shoot your queries to [email_address] Thank You!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×