• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Building SharePoint 2010 Customisations with Visual Studio 2010: Overview and Tips

  • 2,942 views
Uploaded on

This presentation is from the Christchurch SharePoint User Group and presents 3 tips/tricks/issues when building customisations for SharePoint 2010 using Visual Studio 2010.

This presentation is from the Christchurch SharePoint User Group and presents 3 tips/tricks/issues when building customisations for SharePoint 2010 using Visual Studio 2010.

More in: Education , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
2,942
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
39
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. SharePoint Development: Visual Studio 2010 Deployment Tips Nick Hadlee @nickhadlee http://hadlee.net.nz
  • 2. SharePoint 2010 Development with Visual Studio 2010 Overview  Intro: SharePoint Deployment…how Visual Studio 2010 affects what [and how] things are deployed to SharePoint  The Solution Package  Features  SPI’s  Properties, Properties, Properties: F4 is our Friend  The Solutions Package  Features  Visual Web Parts  Fixing the (default) Namespace Clutter  Replaceable Tokens
  • 3. SharePoint 2010 Development with Visual Studio 2010 Introduction  Deployment ‘best practice’ Solutions & Features  Visual Studio 2010 supports SharePoint development natively  A Visual Studio SharePoint Project output is a SharePoint solution package (.wsp)  F5 for debugging  Right click to add things to the project  Features  SPI’s (or SharePoint Project Items) – SharePoint “objects” e.g. Content Types, Site Columns, Web Parts, Modules (files), List Definitions, List Instances etc. etc.  Supporting Files are deployed to the {SharePoint Root} (14 Hive) via mapped folders – /_layouts, /_layouts/images  The main problem? The project is by default very, very flat…
  • 4. Properties, Properties, Properties
  • 5. SharePoint 2010 Development with Visual Studio 2010 Visual Studio 2010: Properties = Behavior  Properties (F4) – most items in the project have properties that control the final deployment  Solution (Visual Studio) – most important properties are on the Project. Won’t see the solution node unless there are multiple projects in the solution  Project  F4 – Sandbox Solution, Site URL, Assembly Deployment Type  ALT+ENTER – Default Namespace and other project properties  Solution Package – Id, Title  Feature – Id, Title, Deployment Path (Feature Folder Naming)  Web Part – Deployment Path  To control your deployment you must use the properties in Visual Studio
  • 6. SharePoint 2010 Development with Visual Studio 2010 Project Properties  Sandboxed Solution  Site URL  Assembly Deployment Type Global vs. Web Application …
  • 7. SharePoint 2010 Development with Visual Studio 2010 Package (Solution) Properties  Name / Title  Solution Id …
  • 8. SharePoint 2010 Development with Visual Studio 2010 Feature Properties $SharePoint.Project.FileNameWithoutExtension$_$SharePoint.Feature.FileNameWithoutExtension$  Deployment Path  Feature Id  Title [Connected to Feature Designer] …
  • 9. SharePoint 2010 Development with Visual Studio 2010 Web Part Properties  Deployment Location …
  • 10. Fixing the (default) Namespace Clutter
  • 11. SharePoint 2010 Development with Visual Studio 2010 Namespaces  Visual Studio’s ‘management’ of the namespaces related to your project are horrible  Namespaces cascade down (a little)  Solution Package (default namespace) + Web Part SPI (+ Web Part Class for the full strong name)  How do you control these? … Manually
  • 12. SharePoint 2010 Development with Visual Studio 2010 Add a New Web Part
  • 13. SharePoint 2010 Development with Visual Studio 2010 Namespaces
  • 14. SharePoint 2010 Development with Visual Studio 2010 Namespaces – References  Understanding folders and namespaces in Visual Studio 2010 SharePoint Solutions, Packages and Features http://www.wictorwilen.se/Post/Understanding-folders-and- namespaces-in-Visual-Studio-2010-SharePoint-Solutions-Packages- and-Features.aspx  Understanding folders and namespaces in Visual Studio 2010 SharePoint Solutions, Packages and Features - part 2 http://www.wictorwilen.se/Post/Understanding-folders-and- namespaces-in-Visual-Studio-2010-SharePoint-Solutions-Packages- and-Features-part-2.aspx
  • 15. Replaceable Tokens
  • 16. SharePoint 2010 Development with Visual Studio 2010 Replaceable Tokens  Begin and end with a dollar sign ($). Any tokens used are replaced with actual values when a project is packaged into a SharePoint solution package (.wsp) file at deployment time.  Feature Naming  Strong Naming  Can/should/have to be used by you  By default used in: XML, ASCX, ASPX, Webpart, DWP  Defined in <TokenReplacementFileExtensions> element in the Microsoft.VisualStudio.SharePoint.targets *  Additional file extensions can be added – e.g. svc  Tokens only replaced in files that are not compiled – e.g. not used .cs, .vb or .resx.. Reference  Replaceable Parameters msdn.microsoft.com/en-us/library/ee231545.aspx  Nifty Trick http://www.wictorwilen.se/Post/Nifty-trick-with-Visual-Studio-2010-replaceable-parameters-for- SharePoint-2010-Web-Parts.aspx * …<program files>MSBuildMicrosoftVisualStudiov10.0SharePointTools
  • 17. SharePoint 2010 Development with Visual Studio 2010 Replaceable Tokens Name Description $SharePoint.Project.FileName$ The name of the containing project file, such as, "NewProj.csproj". $SharePoint.Project.FileNameWithoutExtension$ The name of the containing project file without the file name extension. For example, "NewProj". $SharePoint.Project.AssemblyFullName$ The display name (strong name) of the containing project’s output assembly. $SharePoint.Project.AssemblyFileName$ The name of the containing project’s output assembly. $SharePoint.Project.AssemblyFileNameWithoutExtension$ The name of the containing project’s output assembly, without the file name extension. $SharePoint.Project.AssemblyPublicKeyToken$ The public key token of the containing project’s output assembly, converted to a string. (16-characters in "x2" hexadecimal format.) $SharePoint.Package.Name$ The name of the containing package. … …
  • 18. SharePoint 2010 Development with Visual Studio 2010 Replaceable Tokens  Can help to limit refactoring through less “hard coding” <type name="DemoProject.WebParts.MyWebPart, $SharePoint.Project.AssemblyFullName$" />  GuidAttribute using System.Runtime.InteropServices; namespace DemoProject.WebParts { [ToolboxItemAttribute(false)] [Guid("B7DB18AA-B8A7-4CD1-8389-03809D827EF0")] public class MyWebPart : WebPart { // ... } } <type name="$SharePoint.Type.b7db18aa-b8a7-4cd1-8389-03809d827ef0.FullName$, $SharePoint.Project.AssemblyFullName$" /> msdn.microsoft.com/en-us/library/system.runtime.interopservices.guidattribute.aspx
  • 19. Questions
  • 20. Resources
  • 21. SharePoint 2010 Development with Visual Studio 2010 Community Forums and Helpful Sites  MSDN SharePoint Forums social.msdn.microsoft.com/Forums/en/category/sharepoint  SharePoint Overflow www.sharepointoverflow.com  SharePoint DevWiki www.sharepointdevwiki.com  SharePoint Team Blog blogs.msdn.com/b/sharepoint
  • 22. SharePoint 2010 Development with Visual Studio 2010 Technical Resources  Channel 9 channel9.msdn.com/learn/courses/SharePoint2010Developer  SharePoint on TechNet technet.microsoft.com/en-us/sharepoint/  SharePoint Developer Centre msdn.microsoft.com/en-us/sharepoint/  SharePoint 2010 SDK msdn.microsoft.com/en-us/library/ee557253.aspx  Patterns and Practices spg.codeplex.com
  • 23. Thank You