The Big Dummies Guide to Setting up your SharePoint Virtual Development Environment

Okay, so it’s a long title. And hey, this is a long post (I seem to be doing that recently) but I was struggling with VMs, IE7, and SharePoint and figured I would put this together for those that want to build their own SharePoint development environment in a stand-alone virtual machine. While it’s still basically install a few pieces of software, there’s a lot of configuring going on, extra tools you can (should) use, and a few gotchas when it comes to Virtual Machines and things like Visual Studio solutions.

Note that this is my preferred setup. It has tools that I use and configurations I prefer. This isn’t the only way to fly and I’m sure others out there have other ways of doing this (for example developing on a Windows XP box rather than directly on a server, using differencing disks, local files, small lizards, logging chains, etc.) but this works for me and I’m comfortable with it. Most tools and VS addins are optional and totally up to the reader. Feel free to tweak these instructions as you see fit, add/remove/suggest components, or throw it out altogether.

This is part of my bag of tricks I’m sharing with you. Please use it for good, not evil.

Setup
This assumes that you’ll be using a virtual server type of software (Virtual PC, Virtual Server, or VMWare). Makes no difference but I prefer Virtual PC for now as I can drag and drop files from my desktop into it. Virtual PC and Virtual Server images are compatible so you can build in VPC and use it in Virtual Server if you want. I generally give the VM 1–2GB of RAM as its going to be running everything (Windows Server, SQL, SharePoint, Visual Studio, etc.) so it’ll need it (1GB when I run on my laptop which has a max of 2GB, and 2GB to the VM when I run on my desktop which has a max of 4GB).

I generally don’t keep source code in my VM (or it’s very temporary, say for demos) so I keep it generally on an external drive. This drive is shared to the VM as the Z:. Also keep your VHD files (Virtual Hard disk, or whatever VMWare uses) on an external drive. Mucho better performanco.

Also this a workgroup install rather than a domain controller. Some people like having a DC running with SharePoint but I like to keep it separate. You can also spin up a domain controller VM and connect the machine to the domain through the local network later.

Installing
Okay, here’s the rundown of what gets installed. Some things can be shifted around in order of preference, but obviously you can’t install SharePoint before you install SQL Server. Again, feel free to move things around as you see fit.

No detailed instructions for installing most of this (but feel free to ask for clarification on anything, as some of it might not make much sense). Just follow the wizards entering whatever information is needed and you can generally accept the defaults. Really, it’s not that complicated. Also I make things easy for development like creating a single user for everything and just giving them admin rights to the box. In a real setup you would have domain accounts and only grant them the rights they need in SQL Server. I just find having as few things possible make it easier for development (and we’ll worry about configuration later in the test/production environment).

Windows Setup

  • Install Windows Server 2003 Standard Edition. Any edition will do, but this one works fine.
  • Install Windows Server 2003 Service Pack 1
  • Create local spadmin account on the machine. Add to the Local Administrators group. This will be used for all portal functions.
  • Create local spuser account on the machine. You can use this as a reader or contributor on your sites for testing (and feel free to create more, but I find two is enough)
  • Setup IIS. Just the basic options are needed here.

  • Remove event tracker shutdown dialog. What a PITA this thing is for development.
  • I prefer to browse to http://machinename rather than http://localhost. Add machinename to trusted sites in IE for this to work. This will eliminate the NT challenge/response dialog when you browse to the site, and all urls will be better formed.
  • Edit the command prompt to add QuickEdit. Just handy when copying/pasting things like wp part packs in the command window.

Mail Server

  • Install hMailServer. This is a free (open source) SMTP/POP3 server that I use instead of Exchange. Lightweight and free. Alternately you can install Exchange if you really want to.
  • Add a catch all account to the mail server – admin@yourdomain.com. This will be used for any mail to/from the Portal or WSS sites.
  • Add user account – username@yourdomain.com. This is attached to the user account for the portal (or you can use admin for everything)

SQL Server

  • Install SQL 2000. Standard OOTB install, configure it to run in mixed mode. I use SQL instead of the built in MSDE so I do testing with full text searches.
  • Install SQL 2000 SP4.

SharePoint Install

  • Install SharePoint Portal Server 2003 without the database engine. We’ll connect it to SQL during setup phase.
  • Configure and create the initial portal. Name it whatever you want like “Development Portal”, “My Little Pony”, “Big Man Hands”, whatever.
  • Use the spadmin account name you created above for all operations.
  • Use localhost for the mail server.
  • Give spadmin email address of admin@yourdomain.com.
  • Add machinename\spuser (spuser@yourdomain.com) as reader to the portal.
  • Install WSS SP2. Have to install this before we install SPS SP2.
  • Install SPS SP2.
  • Add shortcut to 60 HIVE directory on desktop or QuickLaunch. I just find it a pain to navigate down the ugly tree anytime I need to hit the directory in Explorer so having a folder that goes directly there is handy.
  • Add STSADM dir to path in command prompt. I find this very handy so I can open up a command prompt and just start typing STSADM rather than the full path. Optionally you can install STSADMWin or whatever. I’m just a command prompt kinda guy

IIS Configuration

  • Change WSS_Minimal in web.config to Full. This is required to set debugging=true and makes life easier.
  • Set debug=true in compilation section of web.config for debugging Web Parts

Visual Studio Setup

  • Install and Configure Visual Studio 2003. I just select the default which includes C# and VB.NET but you do whatever works for you.
  • Copy keyboard shortcuts (so ReSharper can install, if you’re installing it)\
  • Install Web Part Templates for Visual Studio .NET. These are the templates for creating new Web Part Library projects.
  • Install ReSharper. Set the persistence to use the local drive (this is for performance of local files vs. remote). I prefer ReSharper but some like CodeRush, Refactor Pro!, and other tools.
  • Install GhostDoc. I use this for creating stub documents for APIs and Web Parts that I’ll be sharing.
  • Install TestDriven.NET. Killer app for TDD and running unit tests. Also includes NCover now. 

SharePoint Tools

  • Copy InstallAssemblies (from the Web Part Toolkit) to server and add to QuickLaunch. You just need the EXE and I like having it on the QuickLaunch taskbar as I can just click on it and install a web part quickly.
  • Install SharePoint Explorer. Best tool for looking at what you have.
  • Install SmartPart (if you’re planning to do development via User Controls)

Office 2003

  • Install Office 2003
  • Install FrontPage 2003

Install Other Tools

  • TopStyle. I use this for editing CSS files but feel free to use Visual Studio (blech) or your own CSS editor (Notepad anyone?)
  • XmlSpy. This comes with a cost, but it’s worth it for Xml editing. There are some less expensive packages and then there’s always… Notepad!
  • IE Dev Toolbar. Very handy for debugging pages and poking around in SharePoint sites.
  • Notepad++/Notepad2. I prefer these over the standard Notepad.
  • Paint.Net if you plan on making your own icons or graphics. Free and written in .NET!
  • SysInternals BGInfo. I have this in my startup for the server as it shows me what the server name is, IP, and other info that is handy when you’re flipping around between machines.
  • Plus any other tools you like. Scott Hanselman’s list here is a great resource.

Testing

  • Create a new web part using the template (Hello World or something)
  • Install using InstallAssemblies. This will add it to the bin dir and create the SafeControl entries in web.config so the web part will work correctly.
  • Add the web part to a page somewhere.
  • Run Web Part project in Visual Studio with debugging to make sure debugging works
  • Create an alert, open up Outlook Express and configure it to use your local mail server (if you installed it). You should receive an alert.

Security and Source Code

When working in a VM you generally do NOT want your source code to be in the VM (just in case it turfs and you can’t recover it) so I keep all my source on an external drive (rather than say the host drive as I move from place to place). I also only have it set to use Local networking meaning it can’t see out and I can’t see in (which is why I prefer Virtual PC so I can drag/drop files to the VM). This allows me to have a domain controller on the local network if I need it.

With Virtual PC you can share this drive as a network drive letter inside the VM (my external drive is always Z:. In order to open files and not get the dreaded “the project location is not fully trusted” you need to fix security policy if you want to open files from a network drive. Google "the project location is not fully trusted" and you’ll get a ton of answers. Problem is that none of these work for a drive that is mapped into a VM. A drive shared shows up in the Intranet Zone. Bizzare huh? Means you have to trust the entire internet zone. Not a good thing. Can’t use z:\\, have to use file:// but there is no file:// for a mapped drive (because there is no server name).

James Kovacs says to use ZoneStripper but I really don’t want to do this with each project so the technique below works well:

  • Open the ".NET Framework Configuration" utility
  • Expand "Runtime Security Policy->Machine->Code Groups"
  • Right click "All Code", and then select the "New..." item
  • Type a name in the "Name" textbox (like “VS Projects on Z:“ or something), and then click the "Next" button
  • Set the condition type to "URL" and type the following string to the "URL:" textbox: “file://Z:/*”
  • Click the "Next" button and assign the "FullTrust" permission set to this Code Group.

This will trust all code on Z: and not display the dialog. You can also use file://servername/* but since we’re working with a drive letter here, we don’t have a server name.

I also run regular scheduled backups of my external drive to whatever host it’s connected with using SyncToy so I generally always have 3 copies around (1 on laptop, 1 on desktop, 1 on drive) and do make weekly DVD backups of the source and CVS trees.

Tips and the Afterlife

  • After your environment is setup, all the tools are running, and you’re happy with what you have created SAVE IT! Snapshot that puppy so you can come back to it. Some people might prefer to use undo disks but again, I find these sometimes have issues so I just copy the whole dang VHD file as an archive in case the worst happens.
  • Setup a Development Area in the Portal. Two things I do as a final step in getting things up and running on the portal. If I installed SPS then I create an area called Development. This is just a collection of sub-areas for various projects, spike web parts, whatever. It leaves the rest of the default portal setup intact as I don’t need to build a taxonomy that represents a production site or anything. If I need something like that (for example to demo what a sample navigation structure might look like) I’ll just create a new Virtual Server in IIS and create a portal off it. I keep the main portal on port 80 for general development.
  • Another thing I do is copy the STS definition and create a new STSDEV site def from this. Not much is changed in the definitions but I do go in and add a top and bottom zone to the default.aspx page. This lets me a) screw around with any list definitions without touching the default STS one and b) have some extra zones to mess with in case I want them. I also setup 10 pages in the default module which are copied at creation time. These are placeholder pages (copied from default.aspx) which I can use instead of web part pages and are ghosted so I don’t worry about them showing up in something like Ghost Hunter. Finally I create a new site called Sandbox using this config and add it to my Development section in SPS as a listing to quickly get to it. For most web parts, I develop them so they work in both a SPS area and a WSS site (unless it has SPS specific stuff).

Okay, now go start using your portal for development. It’s complete, self-sufficient, and fun for the whole family.

Whew.

7 Comments

  • Cool post Bil, it's really a good reference. Thanks.

  • Great Post Bil. Once again you beat me to it as I was working on a similar post :)



    One thing I do also is create or clone a second second server that will be used as a SQL Server not connected to the domain. One of my environments is like this and we have to pass through the network service to gain access to the SQL box along with using SQL Authetication. Some applications (SYNTERGY's Audit Tool for one) will not work with this mode so having this environment set up on the side gives me the opportunity to test apps for that environemnt thus saving the company from spending money on things that they would like to have and things that wont work in there env.



    Everything else you have here is dead on to what i am using... i tend to keep everything on the one server ( AD, IIS, SP,SQL etc) for normal day to day testing.



    Great write up Bil.

  • Bil,



    This is an all-star post! In fact I would recommend making it available as a downloadable PDF as well. It's a borerline whitepaper.



    Awesome job - hats off! - Shane

  • This was great help except for one minor problem. Sharepoint is set up on a server, not my local box. I do all developement on my box then transer it to the server. Because of this where do I install the web part templates to?

  • Great Post ! Thanks for sharing !

  • I have played around a little bit with the VMware and have had a lot of fun with it. I still have more that I need to work on to get it all figured out, but it is a really fun tool to mess around with if you just want to play with a computer. www.ecrion.com

  • I always set my *development* boxes to Full trust. I also then have a separate box (or boxes) to test.

    The real problem is fighting something for hours (and hours and hours) to realize that it was some sort of security that you didn't have. So I open my dev box up completely (it's a VPC anyway -- natted so noone can get to it.) Then I go back and tighten things up after I'm done with development. I look at CAS as an implementation detail that has to be done just like creating a CAB file, MSI, documentation, etc.

    Just my perspective ...

Comments have been disabled for this content.