Now available, SharePoint 2010 Development with SharePoint, a comprehensive and fun guide to developing rich, interactive SharePoint solutions with Silverlight.
If you're a typical SharePoint developer these days, you might be sporting a turbo-charged 16GB laptop and running your SharePoint development environment in one or more virtual machines. SharePoint 2010, SQL Server 2008 R2 (or the Denali RC!) and Visual Studio 2010 run like a well-oiled machine if you have fast enough hardware under the hood.
But you might be wondering if you're getting the most out of all that horsepower. Let's face it, as a hardcore SharePoint dev, you spend countless hours working in this VM. It's worth investing the time to streamline your experience and make it a pleasure to build your best solutions. This article will show you how to soup up your VM and get your development process firing on all cylinders.
If you've just installed your first dev environment, then a lot of these tips will apply. If you've downloaded the Demo2010a VM set, then some of them have already been done for you. Even if you're a seasoned SharePoint developer, I hope at least one or two of them will shave a few seconds here and there. I’d also like to invite your comments and ideas so I can get some mileage from your experiences as well!
Seek the Open Road
Even though it's technically possible to develop SharePoint solutions in Windows 7, most of us still take the Windows Server 2008 R2 route so we can get all the services to work. But Windows Server isn't intended as a client OS, it's designed to run reliably and securely in a data center.
There are plenty of pop-ups and other security roadblocks to slow you down, but you can steer clear of them with the right policies. (NOTE: I'm very careful with my firewall settings and I don't browse the Internet at all from my development box, so I don't mind running with shields "down." Proceed at your own risk!)
Map Out Your Network
If you have to reconfigure or fiddle with your network every time you use your VM on a new network, you really need to tune up your network configuration. This is often a problem, especially if you have more than one VM. The core issue is this: servers, such as your Domain Controller and SharePoint server, really like to have fixed IP addresses, yet your laptop thrives on dynamic IP addresses assigned by the DHCP server of whatever network you happen to be on.
The solution is simple: set up two networks, one with fixed IP addresses and one with dynamic. Think of the fixed IP network as a local road, only accessible to your VM's and host computer, and the dynamic IP network as the onramp to the rest of the world.
Use your virtualization tool to set up internal (static IP) and external (dynamic IP) virtual networks, as shown in the table below, and add both network adapters to each VM.
Fixed IP Network
Dynamic IP Network
External (or bridge an internal network to a wireless adapter for wifi support)
To configure the static IP network, edit the settings on the internal adapters on each VM and your host, and give each one a unique static IP address in the same subnetwork. To do this, open the Network and Sharing Center and click "Change Adapter Settings" on the left; right-click on the adapter and select "Properties". Highlight the TCP/IP v4 item and click "Properties" again. Remember to use the same subnet mask for each one, and to use a reserved IP address range. If that last sentence made no sense, just pick one of the address ranges below that is not in use on any of the networks you use regularly, and give each computer a unique number in that range. I purposely chose ranges that aren't typically defaults for home routers to avoid conflicts.
For each adapter, set the subnet mask to 255.255.255.0, and enter the domain controller's IP address as the DNS address (even on the domain controller itself). As servers join the domain, the DC will automatically enter them in DNS so you can address them by name.
If you regularly use VM's with different IP address ranges, you can avoid having to change the host's static IP address by simply assigning multiple IP addresses to the host's adapter. To do this, click "Advanced" in the TCP/IP v4 property page; this will allow you to add and remove many IP addresses. Then go to the "DNS" tab on the same dialog box and enter all the domain controller IP addresses as alternate DNS servers.
The second network is easier to set up. For your onramp to your LAN and ultimately the Internet, choose a virtual network type as shown in the table for a dynamic IP network, and leave the other settings alone. This will allow you to call out from your VM, as well as to make incoming connections from other computers for remote desktop access or file transfers. Just be sure to turn on the firewall on all the VM's if you're going to use this on a shared or public network.
If you have trouble connecting by name among the servers, or from the host to the servers, check the network provider order on the client side. This setting can make all the difference, but it's hidden. From the Network and Sharing Center, click "Change adapter settings". Then press the Alt key. A new menu will be revealed; choose the "Advanced Settings" option on the "Advanced" menu. (Do you get the feeling they don't want you messing with this?) Now click the "priority order" tab. There you will see all your network providers; use the arrows to set their priority. Making the static IP network a higher priority than the dynamic will ensure a reliable connection.
Torque Up the Experience
A SharePoint development machine is both a client and a server, and to get the most out of the client part you really need to turn on the Desktop Experience. This is a Windows feature that can be enabled in the Server Manager. Not only does it turn on the Windows 7 UI, it also enables the WebDAV protocol, which is used inSharePoint's explorer view and for some open and save dialog boxes.
Once this is enabled, start the Themes service to get the full experience.
At this point, if your (virtual) hardware is up to it, Aero should work. If not, there's still hope through Remote Desktop. To enable Aero through remote desktop, first log into the server. Select "Run" on the start menu and enter "tsconfig.msc". You should see an RDP-Tcp connection in the middle of the screen; right-click on it and select "Properties." On the "Client Settings" menu, set the "Maximum Color Depth" to 32-bits, then click "Apply", and then un-check the "Limit Maximum Color Depth" checkbox. To work, the "Maximum Color Depth" should be grayed out and showing 32-bits (go figure!) Click "OK".
Next, still on the server, go back to the group policy editor (gpedit.msc). Drill down to Computer Configuration/Administrative Tools/Windows Components/Remote Desktop Services/Remote Desktop Session Host/Remote Session Environment. Disable "Limit maximum color depth" and enable "Allow desktop composition for remote desktop".
Finally, on the remote desktop client, click "Options" on the splash screen and go to the "Experience" tab. All the checkboxes, and in particular the "Desktop composition" option, must be selected for Aero to work. Why not a little chrome?Upgrade the Tool Box
Having access to the best tools can really accelerate your development process. Here are my favorites which I always install on a development machine.
Shift Into OverdriveThere are two things that affect VM performance more than anything else: memory and disk speed. If you can give 6-8GB to each SharePoint VM, you should be in good shape. But a slow drive will still make your setup as pokey as an old jalopy.
One thing you can do to improve VM performance on any rotating drive is to switch from dynamic to static virtual disks. Once you defrag the physical drive, the virtual drive file will stay in one contiguous block. After that, you can just defrag the virtual drive (from inside the VM) and forget having to compact it and defragthe physical drive.
Of course solid state drives are the best by far, but if they give you sticker shock then try a hybrid drive instead. These drives cost only a little more than a conventional hard drive, but have an SSD cache that greatly reduces the time it takes to read small amounts of information scattered around the disk. Since they're optimized for short accesses, these hybrids are nothing special for large transfers, such as file copies and streaming videos, but they provide a huge boost when booting up a VM. I've had good luck with a Seagate Momentus XT; I have use a USB 3.0 enclosure with the 500GB version (street price $130), which sports a 4GB SSD. I'd love to upgrade to the shiny new 750GB version (available for about $175), which doubles the SSD to 8GB. Even on the smaller drive, I definitely notice my VMs getting faster after each boot, as the drive caches the most frequently accessed data.
(NOTE: The Momentus XT is sold as a bare drive, so plan to buy an enclosure for it if you're not replacing your internal drive. Enclosures with your choice of USB 3.0, ESATA, or Firewire are easy to install with just a screwdriver.)
Bonus Tip: Keep Left
As a bonus, here's a small and handy tip. It's so simple I'm not sure if it counts!
Here it is: move the Windows task bar from the bottom of the screen to the left. Yes, that's all. To do this, just right-click the task bar and select "Properties".
Perhaps you're scratching your head at this one. Isn't that just a matter of preference you ask? No, it's more than a just a chrome option.
I find that when working on VM's I often have a machine running in a window. Sometimes when I'm also working remotely, I have two machines nested. What a pain it is if the window sizes don't align, and you have to scroll around the inner desktop! It's extra painful because the start menu and task bar are way down the bottom of the screen, yet application menus and tool bars tend to be near the top, causing no end of scrolling. By putting the task bar on the left (or the top), it's already in view in this situation, and that can save a whole lot of scrolling.
Share a Ride
If you have a tip or shortcut I've missed, I'd appreciate it if you dropped it in the comments. It would be great to see what you've run into.
Happy travels and thanks for reading!