Tips and Tricks for Developing MOSS Applications
description
Transcript of Tips and Tricks for Developing MOSS Applications
![Page 1: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/1.jpg)
Alex HolcombeApplied Information Sciences
![Page 2: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/2.jpg)
SharePoint to a DeveloperDevelopment environmentDebuggingConfiguration ManagementBasic Do’s and Don’ts
![Page 3: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/3.jpg)
![Page 4: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/4.jpg)
Tighter integration with ASP.NET 2.0
“Shines Through”: Master Pages Web Parts Custom Provider Model
Conceptual Differences: Template Model Users can edit pages
ASP.NET 2.0ASP.NET 2.0
Windows Windows SharePoint SharePoint Services Services “v3”“v3”
![Page 5: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/5.jpg)
WebParts Event Handlers Custom ASPX Pages Web Services Site Administration
functionality Searching Timer Jobs STSADM Workflows
Site Columns Field Types Content Types List Definitions Master Pages Site Definitions
![Page 6: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/6.jpg)
SharePoint IS: An Application Full of OOTB functionality Deceptively complex Extensible using .NET Written by someone else (not you)
SharePoint IS NOT: A relational database A replacement for all web-based
applications
![Page 7: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/7.jpg)
Show example functionality
![Page 8: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/8.jpg)
Microsoft Software Windows Server 2003 Visual Studio 2005 SQL (Express) and SQL Management Tools .NET 3.0 Framework ECM Starter Kit Visual Studio extensions for WF Visual Studio extensions for WSS
Other Reflector Text searching tool
![Page 9: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/9.jpg)
Several basic requirements for devs Source Control Access Baseline to clean environment Backup and restore process Consistent baseline across all developers Software upgrade management External Access (web, email)
![Page 10: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/10.jpg)
“The supported approach for setting up your Web Part development environment is to develop locally on an Office SharePoint Server 2007 server.” Getting Started with Custom Enterprise
Search Web Parts (http://msdn2.microsoft.com/en-us/library/ms564508.aspx)
![Page 11: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/11.jpg)
Option Pros Cons
SharePoint server with development tools and devs RDC to it
•Easy to set up•Easy to centrally manage
•Shared resources•One dev may bring down environment for others
Install SharePoint on each developer workstation
•Developers are isolated from each other
•Need to reimage to Windows Server 2003
Create SharePoint VPC and run on each developer workstation
•Developers are isolated from each other•Portable and independent environment
•May cause networking problems (ex DHCP, multiple DC’s)•Resource intensive•Images need to be sysprep’d before sharing
![Page 12: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/12.jpg)
DC, Source Control, etc192.168.1.1…n
Dev 3192.168.1.13
Dev 2192.168.1.12
Dev 1192.168.1.11
Dev Machines:Win 2k3MOSSSQL ExpressDev tools
![Page 13: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/13.jpg)
DC, Source Control, etc192.168.1.1…n
Dev 3192.168.1.13 (host)192.168.1.103 (vpc)
Dev 2192.168.1.12 (host)192.168.1.102 (vpc)
Dev 1192.168.1.11 (host)192.168.1.101 (vpc)
Dev Host:Win XP
VPC:Win 2k3MOSSSQL ExpressDev tools
![Page 14: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/14.jpg)
No network connectivity Makes network admin’s happy Difficult to connect to source control
Attach VPC to host network adapter Use NAT Assign a secondary IP address to the
VPCAttach VPC to host loopback adapter
Install loopback adapter on host Allow VPC to access internet through ICS
![Page 15: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/15.jpg)
Install only what you need Keep the .vhd as small as possible Run from an external disk or separate
partition Allocate as much RAM as possible Shut down unnecessary apps on the
host Access the VPC through RDC Regularly defrag host and VPC Use Compact utility
![Page 16: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/16.jpg)
Show how networking is set up on host and vpc
![Page 17: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/17.jpg)
Compile codeStop IISDeploy assemblyStart IISSet breakpoint in code Initialize a SharePoint pageAttach to all w3wp.exe processes
![Page 18: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/18.jpg)
HELP - It didn’t work!!! Code is different or didn’t compile New Assembly didn’t get picked up▪ Didn’t get GAC’d▪ IIS not reset
Feature not properly installed or activated
Code isn’t being executed
![Page 19: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/19.jpg)
Enable Script Debugging in IEAttach to IE.exe processOpen Running Documents window in
VS (Ctrl-Alt-N)
Set breakpointOpen page/click to execute
![Page 20: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/20.jpg)
Located in: 12\LOGSTurn up logging in SharePoint
From Central Administration: Operations \ Diagnostic Logging \ Event
Throttling▪ Select a Category: “All”▪ Least Critical…event log: “Information”▪ Least Critical…trace log: “Verbose”
Use a good text editor to search through the logs
![Page 21: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/21.jpg)
Turn on logging in IIS Open web.config in the web app root
Modify the following: <configuration>
<SharePoint>▪ <SafeMode> ▪ set Callstack = "true"
<configuration> <system.web>▪ <customErrors> ▪ set mode="Off".
▪ <compilation>▪ set debug="true".
![Page 22: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/22.jpg)
Attach to w3wp processAttach to IE process Increase logging level in SharePoint
![Page 23: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/23.jpg)
Usual location: C:\program files\common files\microsoft
shared\web server extensions\12NEVER modify any OOTB filesCreate a script which copies/updates
your files in the 12 hiveUnderstand the consequences of
modifying the files you created
![Page 24: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/24.jpg)
List of folders in the 12 hive that are commonly used by developers (not comprehensive)
12 CONFIG – stsadm commands, security trust files LOGS– SharePoint log files Resources - .resx files TEMPLATE▪ CONTROLTEMPLATES – .ascx files▪ FEATURES – Feature files▪ LAYOUTS – .aspx files▪ SiteTemplates – Site Definition files▪ XML – Field Type definitions
![Page 25: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/25.jpg)
Search the web MSDN Google Groups Blogs
Is this being done OOTB? Search the 12 hive Search using Reflector
![Page 26: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/26.jpg)
The 12 Hive is a valuable resource for information
Use it to see how things are being done OOTB
SharePoint functionality is deployed as Features
![Page 27: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/27.jpg)
CONTROLTEMPLATES DefaultTemplates.ascx – Rendering field
templates Features
Ctypes – OOTB Content type definitions CustomList – Custom List definition Fields – OOTB field definitions
SiteTemplates Sts – OOTB Teamsite site definition
This is a small subset of what is there
![Page 28: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/28.jpg)
Find information in 12 hive Search for examples of OOTB
functionality
![Page 29: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/29.jpg)
Multiple ways to create “things”: UI XML Code
Can be problematic for a developer Each has it’s own pro’s and con’s They are NOT equal Must understand the impact of each:
How do you manage changes / source control
How is it deployed How is it maintained
![Page 30: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/30.jpg)
Site templates CAB package of differences from site
definition Stored in content database End-user created
Site definitions Core description of what a site is Installed to web front ends Developer created Done through xml files Can be extended with code
![Page 31: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/31.jpg)
Modular provisioning: Features! Less XML to create site templates Less duplication Reusable pieces of customization
Group logical elements intoscenario-driven “features”
Easier to add functionality to existing sites Easier to change site functions over time Admins can turn features on/off
![Page 32: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/32.jpg)
Developer packages a custom Web application into a solution
Admin deploys: Files go to all Web front-end servers Can deploy to application servers
Solutions can contain: Feature definitions Site definitions Template pages and resources Resources Global, bin assemblies
![Page 33: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/33.jpg)
Basic rules for CM: Source control everything Stage deployable files Automate deployment for staged files
Use what works best for you, but automate it Batch files Nant / MSBuild MSI file
![Page 34: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/34.jpg)
Location Pros Cons
Bin directory •More secure•Takes advantage of CAS•Deployed to each web application
•Have to deal with CAS
GAC •Easier to deploy•Don’t have to worry about security
•Don’t have to worry about security (putting it off)
Don’t assume you will be able to deploy to the GAC on the production servers
![Page 35: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/35.jpg)
1. Stop IIS2. Deactivate existing feature3. Uninstall existing feature4. Delete existing files5. Remove existing assembly6. Register new assembly7. Copy new files8. Install new feature9. Activate new feature10.Start IIS
![Page 36: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/36.jpg)
Using STSADM Easy to script out with batch files Initializes on each call Can be time consuming
Using OM Initializes once Very fast Useful when deploying large number of
features
![Page 37: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/37.jpg)
Show sample batch fileShow sample Nant scriptShow code to install with OM
![Page 38: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/38.jpg)
Don’t modify any existing files Don’t assume your assembly will go in
the GAC Don’t run everything as an
administrator Don’t manually copy any files Don’t modify or directly access the
Database Don’t assume the server is “localhost”
![Page 39: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/39.jpg)
Try to use as much OOTB functionality as possible
Put everything under source controlAutomate the deployment processKISS when trying something newDon’t assume you’ve done anything
correctlyCheck the basic things firstTry it through the UI (if possible)
![Page 40: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/40.jpg)
SharePoint IS: An Application Full of OOTB functionality Deceptively complex Written by someone else Extensible using .NET
SharePoint IS NOT: A relational database A replacement for all web-based
applications
![Page 41: Tips and Tricks for Developing MOSS Applications](https://reader035.fdocuments.net/reader035/viewer/2022062423/568146ce550346895db40668/html5/thumbnails/41.jpg)
Alex Holcombe Applied Information Sciences [email protected]