views:

289

answers:

4

I have been investigating building web parts for sharepoint 2010 and currently have a single instance of SP2010 on the work servers. I would very much like to be able to test them locally (on my laptop) if possible, without having to install sharepoint 2010 on my laptop (is this even possible?!)

Is there a way to test web parts and do I need to install all/part of sharepoint on my laptop?

Thanks

+4  A: 

If your Web part is simply displayed in a SharePoint page, without using the SP API, you could simply host it in an ASP.NET page on your laptop, but this is not a common scenario.

One new feature of SP 2010 is the client API, i.e. a subset of the full API that can be used outside of the farm. If your usage of the API fits in this subset, this could be useful, but you will still need to access a SP server somewhere.

Another option is to put all the code that uses the SP API in something similar to a Database Access Layer which talks to SP on one hand and returns business objects (not lists or lists items). This way, you could simulate this part on your laptop and concentrate on the look of the Web part and its business rules, without SP. If this part is in its own DLL, the only reference to SP DLLs would be there, so the project on your laptop would not need to reference the SP DLLs.

Timores
+1  A: 

There are two ways: the good one and old-school.

The good way is to install Sharepoint Services (http://technet.microsoft.com/en-us/windowsserver/sharepoint/default.aspx) and deploy WP locally. It works only if you have Windows Vista or Seven. It is the most productive way so i recomend it.

Another way comes from SP2003 era... The idea is to develop custom Web Control, test it locally with IIS or just development server, and then to embed it into web part. The method is described here - http://www.reflectionit.nl/SmartPart.aspx . It's an old and painful method. Unfortunately we can't use (without troubles) Microsoft.Sharepoint.dll etc

P.S. Sorry for my English...

ILya
I have windows 7 (32-bit) so I cant install sharepoint services.
Russell
Why not? Hope it will help:http://www.markwilson.co.uk/blog/2009/03/installing-windows-sharepoint-services-on-windows-7-or-vista.htmhttp://weblogs.asp.net/gunnarpeipman/archive/2009/05/07/running-sharepoint-on-windows-7.aspxBoth articles are appliable to 32bit Windows7
ILya
The articles are talking about SharePoint 2007 (specifically WSS3) - the OP is asking about SharePoint 2010 which is 64bit only.
Ryan
A: 

I would say get a virtual machine.. but I dont think you can run 64bit VM's on a 32bit OS. You'll have to upgrade to 64bit.

I don't think there is a good way around this; you will spend a lot of time on something of questionable value if you do not install SharePoint either on your laptop or in a VM and do it the proper way.

ArjanP
With VMWare you can run 64bit VM's on a 32bit OS
KoenVosters
Well there you go, a virtual machine it is..
ArjanP
A: 

You can just swap out the inheritance from the SharePoint Web Part to the ASP.NET equivalent and back again - all the functionality is the same because the newer version was designed with backwards compatibility in mind. Use the ASP.NET version when testing on your laptop.

Here is some more info :-)

http://weblogs.asp.net/scottgu/archive/2006/09/02/Writing-Custom-Web-Parts-for-SharePoint-2007.aspx

IrishChieftain
Note quite true - SharePoint adds a LOT on top of ASP.NET so if you are using anything specific to SharePoint (like for examle reading data from a list) then you won't find the same interface in ASP.NET
Ryan
True, it depends on what you're doing. But in many cases, you can mock up this type of list data.
IrishChieftain
But you've then got the other 1000 SharePoint specific objects/methods that you might want to use. Not exactly just swapping over a few references for anything but the most trivial case.
Ryan
Good point, I've never actually done it on a laptop! Best bet would be to install SP on a VM depending on the specs of the laptop. When it involves a DC, I would be going back to the workstation :-)
IrishChieftain