Wednesday, February 9, 2011

Visual Studio 2010 setup

I had been working with Visual Studio 2003 / 2005 / 2008 and now have 2010. As usual there are some little things to do with the initial setup so that I can be functional again.

Running without a local SharePoint environment
When I try to create a new solution using any of the SharePoint templates, I got the error: A sharepoint server is not installed on this computer is not installed on this computer
It seems like in order to do SharePoint development on VS 2010 I need to have a local SharePoint environment. Unfortunately, I don't have enough horsepower to run SharePoint on my local machine so I have to go with a workaround. I know that this is not ideal, but I don't have a choice at the moment. Searching around, I came across this thread: A SharePoint server is not installed on this computer. One of the posts describes a workaround which is to essentially copy the whole registry tree of the 14 hive. So I went to my SharePoint 2010 server and exported the following [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0] and imported into my development machine. I then restarted Visual Studio and magically I am now able to create SharePoint solutions.

Adding assemblies
Another consequence of not having SharePoint on my local machine, I don't have all the assemblies in the right place. The easy workaround is as follows:

  1. Copy C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI from your SharePoint Server
  2. Paste it into your local machine keeping the same folder hierarchy to be consistent
  3. Run regedit
  4. Add the key [HKLM]\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\SharePoint 2010 Assemblies. (Not sure if it's a Windows 7 change, but I now need to add this key instead: [HKLM]\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\SharePoint 2010 Assemblies).
  5. Set the default value to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI

References: How to display an assembly in the "Add Reference" dialog boxHow to display your assembly "Add References" dialog.



Adding Create GUID
One of the tools I find useful is a GUID generator. For some reason this is not installed by default in VS 2010. The good thing is that it is very easy to do as described in the article: How to enable "Create GUID" option in Visual Studio 2010. The steps are as follows:

  1. Go to Tools->External Tools
  2. Click Add
  3. Enter a title (such as Create GUID)
  4. In the command box, browse to C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\guidgen.exe
  5. Click OK

No comments:

Post a Comment