Welcome to weblogs.com.pk Sign in | Join | Help

Sharepoint Development with Visual Studio

Sorry for not posting regularly lately; I was away busy learning/using/preaching and coaching about Silverlight and Sharepoint. All in all, it was great learning expereince!

Sharepoint development is bit tricky to start with. Sharepoint is flexible and thus bit complicated to deal with. There are number of ways for Sharepoint Development. I opted to use Visual Studio Extensions for Windows Sharepoint Services (VseWss) whose latest version is v1.3 March 2009 CTP (Note its CTP; and has some issues) for Visual Studio 2008. They didn't finalized it; instead Visual Studio 2010 Beta 2 came recently which has these extensions built into it.

VseWss only works where Sharepoint itself is running; therefore you need Windows 2003 (atleast) as your OS (which by the way I already use and prefer over XP and Vista as development OS; I RDP to my desktop machine running Win2k3 from my notebook which runs Windows 7). The first tip is that install Windows Sharepoint Services with the login you used on the Windows 2003; choosing Basic mode; that also installs “Windows Internal Database” which is a variant of SQL Server 2005 Express Edition but without any limits of SQLEE. By doing this; not only that all the things gets configured; but also your login will automatically become Sharepoint Administrator and Site Collection Owner of the site it creates. And when you will install VseWss; you will be able to use it without any issues; otherwise setting up deployment with VseWss is bit tricky! Also dont forget to give correct url in the project’ debug setting; VseWss uses it to discover the Sharepoint site!

Sharepoint/VseWss combination gets broken often in early days; and uninstalling these both and reinstalling is the most easiest way to get back to the working state; and for this you might need to uninstall the Windows Internal Database as well; on 32bit OS the command is given below; after the command dont forget to delete the %windir%\sysmsi\ssee folder so that the Config/Content and Search databases gets deleted and on reinstalation you dont get any dormant thing back!

msiexec /x {CEB5780F-1A70-44A9-850F-DE6C4F6AA8FB} callerid=ocsetup.exe

Accessing Windows Internal Database instance using SQL Management Studio is also bit tricky; specify the following as database server with Windows Authentication and you will get connected!

\\.\pipe\mssql$microsoft##ssee\sql\query

Next for debugging you need to specify the following setting in your sharepoint site’ web.config

<compilation batch="false" debug="true">

You also need to consider that last Released version of Sharepoint Services; is pre .NET 3/3.5; so before using any Ajax / Ajax Toolkit or Silverlight 2’ Server Control; you need to first setup the sharepoint web site and the most easiest way is that you open the site folder using Visual Studio’ Add Existing Web Site…Visual Studio 2008 prompts to convert it!

Sharepoint works seamless if you deploy the things into Global Assembly Cache (GAC); simply drag/drop the assembly into %windir%\Assembly; so if you are using Silverlight 2’ Server Control; deploy that assembly into GAC and register it as SafeControl into sharepoint site’ web.config. If you have some other version of assembly; discover its version and public key token by opening %windir%\Assembly and right click > Properties of the assembly.

<SafeControl Assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.SilverlightControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />

WSP Window is Visual Studio Addin that comes with VseWss and through this; you can view WSP content; the output of the VseWss project is basically a WSP and behind the scene PKG folder gets created having feature XML files. If you are using Source Control; dont forget to add this folder into source control. If you are using Team Foundation Server; simplest way is to include PKG folder into the project. Dont forget to enable View All Files and adding any new folder that gets created whenever you add some new sharepoint feature into your VseWss project.

I will strongly recommend to watch BB13 video (Creating SharePoint Applications with Visual Studio 2008) from PDC 2008; and you will realize where/how VseWss can help you. Channel 9 also has few more screencasts on VseWss which are worth seeing.

From these videos you will learn how you can deploy custom resources (images, HTML files and even ASPX files) into /_layout/; I will suggest to add “12” folder as Toolbar into your Taskbar for easier access to 12 Folder Hive! If you are planning to deploy ASPX files; you can add the ASPX file by adding HTML Page into the VseWss project and renaming it to ASPX. Second, as said earlier; Sharepoint works seamless if you deploy the things into GAC; so when creating the VseWss project; choose Full Trust (Deploy to GAC) option and thirdly  in the ASPX file you might need to give few more details about your assembly; else you will experience Assembly Not Found errors! You can discover the public key token of your assembly the same way like I said about System.Web.Silverlight above!

<%@ Page Language="C#" AutoEventWireup="true" Inherits="MySharepointArtifacts.MyPage, MySharepointArtifacts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=81c24f946f8d399f" %>
Published Thursday, December 10, 2009 6:50 PM by khurram

Comments

# re: Sharepoint Development with Visual Studio

Thursday, December 10, 2009 7:18 PM by khurram

These are the things that I could recall which tease the developers in start. I might have missed; so feel free to post to this or contact me if anything is bothering you especially in the use of VseWss. If I would have faced it myself I might be able to get you out!

New Comments to this post are disabled