Anda di halaman 1dari 91

MSC17: Upgrading Your 2007

Solutions to 2010

Serge van den Oever


&
Mirjam van Olst
Macaw
About Serge van den Oever
•  Working with SharePoint since 2001
•  Macaw Solutions Factory Architect
•  Currently working on huge SharePoint
WCM project for large Dutch insurance
company

•  Blog: weblogs.asp.net/soever
•  Email: serge@macaw.nl
•  Twitter @svdoever
About Mirjam van Olst
•  Microsoft Certified Master SharePoint 2007
•  MVP SharePoint Server
•  SharePoint Architect at Macaw
•  Co-organizing DIWUG and SDN

•  Blog: www.sharepointchick.com
•  Email: mirjam@macaw.nl
•  Twitter @mirjamvanolst
Session Objectives
About migration of solutions from
SharePoint 2007 to SharePoint 2010

We want to inspire you and warn you about


some pitfalls

We will NOT talk about “best practices”,


there are no best practices yet
Agenda

•  SharePoint 2010 development: what’s new


•  Upgrade solutions from SharePoint 2007 to
SharePoint 2010
•  From STP to WSP to Visual Studio Solution
•  Using Existing 2007 Code in 2010
•  Deprecated API's
SharePoint development
2007
•  WSPBuilder, STSDEV, … (see Codeplex!)
•  VSeWSS 1.3 (Microsoft)
•  Loads of custom tools, for example:
●  Macaw Solutions Factory (our custom tooling)
2010
•  Visual Studio tools for SharePoint 2010
•  WSPBuilder 2010, …
One goal

Create a Windows SharePoint Services


Solution Package (WSP)

•  No more manually creating manifest.xml file


•  No more manually specifying DDF file
•  No more using makecab.exe application
Two approaches

12/80/GAC approach
•  SharePoint Root (“12 hive”)
•  Web Application folder (80)
•  Global Assembly Cache (Assemblies)
Abstraction approach
•  Visual Studio project structure
•  Mapping/interpretation/transformation
WSP
Builder
(12/80/GAC)
VSeWSS (abstraction)

Each artifact has


its own feature
Macaw Solutions Factory (abstraction)
standardized project structure
All tools use Visual Studio Extensibility

•  IDE for SharePoint development


•  Build for quick deploy
•  Quick deploy assemblies / assets / ...
•  IIS application pool recycling
•  Attach debugger to IIS worker process
•  Build a WSP package
•  Provide guidance for SharePoint
development
Visual Studio Extensibility (1)

VSeWSS WSPBuilder
Visual Studio Extensibility (2)
Macaw Solutions Factory
Quick Recap: VS2010 SharePoint Dev

Where can files go in migration to VS2010


i.e.
Capabilities of VS2010 for SP2010

Presentations:
•  MSC02: Overview of the SP2010 Developer Platform (Steve Fox)
•  MSC13: VS2010 SharePoint Development Tools Overview (Steve Fox)
•  MSC36: VS2010 SharePoint Tools Extensibility (Wouter van Vugt)
•  MPS02: Developer Deepdive into SharePoint 2010 (Wouter van Vugt)
What can we do in VS2010

•  Map project folders into SharePoint Root


•  Each SharePoint artifact gets its own folder
•  Combine artifacts in a feature
•  Specify assemblies
•  Specify safe controls
•  Modify template manifest.xml
Our first little project...
Specify site for debugging

Note the selection


for
the type of solution:
Sandboxed or
Farm
An empty SharePoint project

PEPTalk! #7
Build and package

Build
Package

Available actions on a SharePoint project


Configurable
Deployment

Out-of-the-box deployment steps.


Use SharePoint extensibility to create
your own, custom deployment steps
and deployment configurations.
Mapped folders (1)

PEPTalk! #7
Mapped Folders (2)

PEPTalk! #7
User Controls

When creating your first user control,


a mapped folder ControlTemplates is
created
Application pages in SP context

PEPTalk! #7
Application pages 101
Application pages (_layouts pages):
•  Custom code allowed
•  No web parts and web part zones allowed
•  Usable in context of any site
•  Live in “14 hive” (…\14\TEMPLATE\LAYOUTS)

Application page must inherit from: Looks promising, but


•  LayoutsPageBase – site security applies no, no designer support
•  UnsecuredLayoutsPageBase – accessible by unauthenticated users (login.aspx page)

DynamicMasterPageFile attribute - dynamic tokens for specifying master page:


•  ~masterurl/default.master – Use master page stored in MasterUrl* property
•  ~masterurl/custom.master – Use master page in CustomMasterUrl* property
* Properties on SPWeb, default value: /_catalogs/masterpage/default.master

Safeguarded Application Pages:


AccessDenied.aspx, MngSiteAdmin.aspx, People.aspx, RecycleBin.aspx,
ReGhost.aspx, ReqAcc.aspx, Settings.aspx, UserDisp.aspx, ViewLsts.aspx

These are the application pages that have safeguards against a broken master page. If these pages
encounter an error when loading the dynamic master page, a safe master page in the _layouts folder
is loaded instead.
Replaceable Parameters
•  Fixed set of available tokens:
●  $SharePoint.Project.FileName$, $SharePoint.Project.FileNameWithoutExtension$
●  $SharePoint.Project.AssemblyFullName$
●  $SharePoint.Project.AssemblyFileName$, $SharePoint.Project.AssemblyFileNameWithoutExtension$
●  $SharePoint.Project.AssemblyPublicKeyToken$
●  $SharePoint.Package.Name$
●  $SharePoint.Package.FileName$, $SharePoint.Package.FileNameWithoutExtension$
●  $SharePoint.Package.Id$
●  $SharePoint.Feature.FileName$, $SharePoint.Feature.FileNameWithoutExtension$
●  $SharePoint.Feature.DeploymentPath$
●  $SharePoint.Feature.Id$
●  $SharePoint.ProjectItem.Name$
●  $SharePoint.Type.<GUID>.AssemblyQualifiedName$
●  $SharePoint.Type.<GUID>.FullName$

•  Tokens not obeying rules don’t expand, without error or warning


•  Works because run location is different from source location
•  Works in package files, manifest files, files with extensions: XML, ASCX, ASPX, Webpart, DWP

•  Add additional extension using <TokenReplacementFileExtensions> in project MSBuild file


•  Define before the <Import> of the SharePoint targets file Microsoft.VisualStudio.SharePoint.targets

 Not as powerful as Macaw Solutions Factory [[Any PowerShell Function]] template expansion
Application page in SP context sample

Note the
page URL in
_layouts
Visual Web Part - creation
Visual Web Part – the user control

PEPTalk! #7
Visual Web Part – user control location

Configured deployment location for ascx


Visual Web Part – ascx design

PEPTalk! #7
Visual Web Part – Elements.xml

PEPTalk! #7
The Visual Web Part on the page
Event Receivers (1)
Event Receivers (2)
Content Types (1)
Content Types (2)… “artifact overload”

Every content type


it’s own top level
node and its own
Elements.xml
Feature Designer

PEPTalk! #7
The Package Explorer
•  Visual representation of the resulting WSP package
•  Not all elements visible (assemblies, safe controls, …)
•  With duplicate names, check properties for deployment
location
Add external or project assemblies
to package

Assemblies
deployed to
GAC must
be signed
Mark types
within
assemblies
as safe
controls
Resource
assemblies
can be
added
Manually from WSPBuilder/STSDEV
to VS2010 (simplistic view)
•  Complete SharePoint Root structure can
be added “as is” (or use mapped folders)
•  Part of the Manifest.xml generated by
WSPBuilder/STSDEV can be added to
Package.Template.xml (exclude root files)
•  Remove assemblies from root files
•  Add code to project(s)
•  Add assemblies to package
Import “complex” WSP package:
Macaw Solutions Factory template
Import as Farm Solution (SP2007)
Import WSP package
Select the items to import
~!@#$%^&
Result project
Resulting Manifest.xml
Original manifest.xml
“Complex” WSP import [OK]
•  All feature elements are converted:
●  List definition
●  Modules (masterpage, ...)
●  Fields
●  Content types

•  All root files are converted


“Complex” WSP import [NOT SO OK]
•  Solution GUID from uppercase to lowercase
•  All Site definitions: gone
•  All Features: gone, empty feature created
•  All safe-control registrations: gone
•  All class resources: gone
•  All GAC assemblies: gone
•  All feature elements in their own folder
Under the hood – the .feature file
On the MyFeature.feature file, right-click, Open with…,
select Source Code (Text) Editor

Feature uses
custom DSL

Manipulate through SharePoint Project system:


ISharePointProjectFeature
Under the hood – the .package file
On the package.package file, right-click, Open with…,
select Source Code (Text) Editor

Package uses
custom DSL

Manipulate through SharePoint Project system:


ISharePointProjectPackage
Upgrade tool for VSeWSS (beta)
•  Provided by Microsoft
•  VS.NET 2010 Templates that allow for importing
of existing VSeWSS projects

•  Converts projects to Visual Studio 10 format and


maintains existing project layout
•  Whitepaper
Upgrade Process
Overview
Overview
Before & After
Refactoring Solutions
•  VSeWSS has feature per artifact
•  VS2010 is more flexible
•  Feature Designer
●  Add/Remove SharePoint Artifacts into features
•  From other projects in solution
●  Feature Rename, Add, Remove and Delete
•  Packaging Explorer
●  Add/Remove Features from WSP
●  Add/Remove custom assemblies
Refactoring Your WSP
But my cool tool feature X is gone!?
•  Xcopy deployment
•  Solution upgrades
•  Visual web parts in sandboxed solutions
•  ...
The answer is:
Visual Studio Extensibility for SharePoint!

Checkout our Dutch hero’s:


•  Wouter van Vugt
•  Waldek Mastykarz
SharePoint Explorer Extensibility

Waldek Mastykarz on the move

http://blog.mastykarz.nl
Community Kit for SharePoint
Dev Edition

http://cksdev.codeplex.com

•  Community Extensions
–  X-Copy Deployment
–  Solution Upgrades
–  Auto Deployment
–  Sandboxed Visual Web Part
–  Linq to SharePoint Classes
–  SharePoint References Tab
–  And much more…

Drop by in the post conference to learn more!


Other upgrade gotchas

•  Upgrading STP files (site templates)


●  No STP files in SharePoint 2010
●  UI changes and challenges

•  Save Site as Template 2010 style


•  Using Existing 2007 Code in 2010
•  Deprecated API's
Upgrading STP Files

•  STP files for sites are no more


Backwards Compatible UI
Site Collection Options

•  Site Settings
> Site Collection Administration
> Supported User Experiences
Site Options
•  Site Settings
> Title, Description
& Appearance
(in 2007 UI Mode)
Object Model Options

•  Web Level
●  SPWeb.UIVersion (int values of 3 or 4)

•  Site Collection
●  SPSite.UIVersionConfigurationEnabled
●  SPSite.UIVersionConfigurationEnabledInAllWebs
CSS Changes

•  What has changed in SharePoint CSS?


●  Almost everything!

•  Any customizations that depend on 2007


CSS such as master pages will need to be
redesigned to work correctly in 2010.

Fully XHTML Compliant


WCAG 2.0 AA level compliant
Custom Actions

•  No more toolbars in 2010 UI Mode


•  Toolbar actions are moved
•  Moved to Custom Commands on the ribbon.
•  It is possible to show ribbon and toolbar by
modifying the list form web part properties.
“Demo”: From STP to VS2010
Save site as template
Brings you to the web interface...
Creates a User Solution in the User
Solution Gallery
New Solution (WSP) can be activated
Site template now available

PEPTalk! #7
Investigate the solution package

•  Right-click on the solution,


select “Save Target As…”
•  Save file as ALMtestSite.WSP
•  Make copy to ALMtestSite.CAB
•  Open CAB file and extract files
•  Investigate the extracted folder structure
The clean export of the site
manifest.xml
ALMtestSiteListInstances\Elements.xml
ALMtestSiteListInstances\ElementsContentType.xml
ALMtestSiteListInstances\ElementsFields.xml
ALMtestSiteListInstances\Feature.xml Manifest.xml
ALMtestSiteListInstances\Files\Lists\Announcements\Schema.xml
ALMtestSiteListInstances\Files\Lists\Calendar\Schema.xml
ALMtestSiteListInstances\Files\Lists\Links\Schema.xml
ALMtestSiteListInstances\Files\Lists\MyCustomList\Schema.xml
ALMtestSiteListInstances\Files\Lists\Tasks\Schema.xml
ALMtestSiteListInstances\Files\Lists\Team Discussion\Schema.xml
ALMtestSiteListInstances\Files\Shared Documents\Schema.xml
ALMtestSiteListInstances\Files\SiteAssets\Schema.xml
ALMtestSiteListInstances\Files\SitePages\Schema.xml
ALMtestSiteListInstances\Files\Test Documents\Schema.xml
ALMtestSiteListInstances\Files\_catalogs\fpdatasources\Schema.xml
ALMtestSiteListInstances\Files\_catalogs\masterpage\Schema.xml
ALMtestSiteListInstances\resources\resources.en-US.resx
ALMtestSiteModules\Elements.xml
ALMtestSiteModules\Feature.xml
ALMtestSiteModules\Files\Shared Documents\TestDoc.txt
ALMtestSiteModules\Files\Shared Documents\TestFolder\TestDocInFolder.txt
ALMtestSiteModules\Files\Test Documents\bla bla.txt
ALMtestSiteModules\Files\Test Documents\TestDoc.txt
ALMtestSiteModules\Files\Test Documents\TestFolder\TestDocInFolder.txt
ALMtestSiteModules\resources\resources.en-US.resx
ALMtestSitePropertyBags\Elements.xml (207kb)
ALMtestSitePropertyBags\Feature.xml
ALMtestSitePropertyBags\resources\resources.en-US.resx
ALMtestSiteWebTemplate\Elements.xml
ALMtestSiteWebTemplate\Feature.xml
ALMtestSiteWebTemplate\ALMtestSite\ONet.xml
ALMtestSiteWebTemplate\resources\resources.en-US.resx
ALMtestSiteWorkflows\Elements.xml
ALMtestSiteWorkflows\Feature.xml
ALMtestSiteWorkflows\resources\resources.en-US.resx
Import solution package into VS2010

Create a new Visual Studio project using


“Import SharePoint Solution Package”
Select the WSP package & items
The result in Visual Studio
Issues: Huge manifest file

Original export was minimal…


Issues: every field has elements file
Issues: loads of property bags with
unnecessary info
Conclusion WSP  VS2010 Solution
•  Export site to WSP is great!
•  Import into VS2010 is cool!
•  Import needs improvement
•  Reducing #artifacts by preprocessing
WSP files is possible, but time consuming
and dangerous
•  No site lifecycle: SharePoint Designer 
WSP  VS2010  WSP  Site Instance
 SharePoint Designer
Using Existing 2007 Code in 2010
•  WSS/MOSS code that runs within IIS will
work without recompilation
•  MOSS 2007 code that runs within the timer
service (Workflows, FeatureReceivers,
TimerJobs) will need to be recompiled
•  Code that runs outside of IIS (that utilizes
the OM) will need to be recompiled or
provided bindingRedirects (Services,
Console apps)
Deprecated API's

•  Numerous API’s have been deprecated.


●  Recompile your application for 2010 and you
will see warnings for any affected API’s within
your application.
●  Deprecated doesn’t always mean unsupported!
●  For now you will just get a compiler warning
●  Most API’s deprecated in 2007 are still in 2010
●  Microsoft will not invest in these API’s in the
future
Summary

•  Lots of very interesting new development


features in VS2010 and SharePoint 2010
•  The answer to all your questions is “it
depends”
•  No more STP files in SharePoint 2010
•  Import .wsp into VS2010 needs some work
•  Some 2007 code will need a recompile
Your Feedback is Important

Please fill out a session evaluation form


drop it off at the conference registration
desk.

Thank you!

Anda mungkin juga menyukai