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!)
- Turn off UAC - Windows User Account Control is that security technology that prompts the user to elevate privileges. Even though it's smoother experience in Windows Server 2008 R2, it can still get in the way. To turn it off, open Control Panel, click "User Accounts", and then click "User Accounts" again. You'll see a link to "Change User Account Control Settings".
- Disable the shutdown event tracker - This is the annoying popup that wants you to explain why you want to shut down the system, even when you're just turning in for the night.To do this, click the "Run" on the start menu and type, "gpedit.msc". The group policy editor will open. In the tree control, open "Computer Configuration" and then "Administrative Templates", then select the "System" node. Scroll way down on the right to find a setting called, "Display Shutdown Event Tracker" and shut it off. Done.
- Nix the 3-fingered salute - Typing Control-Alt-Delete is a security feature to ensure a "trusted path" to give the user confidence they are logging into the software they think they are. It's a pain when using virtual machines, which require special keys since the host will generally intercept the key sequence. So while you're in the Group Policy Manager, why not turn that off as well? The setting is under "Computer Configuration", "Windows Settings", "Security Settings", "Local Policies", "Security Options", and is called, "Interactive logon: Do not require CTRL+ALT+DEL".
- Shut it Down Easy - While you're there, you can enable "Shutdown: Allow system to be shut down without having to log on". This is handy for headless servers as well as if you log off instead of shutting down.
- Disable the dreaded Disable Loopback check - Without this, you can't use your own server as a web client due to a security feature added in IIS 5.1. If you're perpetually prompted when accessing SharePoint from the server itself, this is the wrench in the gears. See http://support.microsoft.com/kb/896861 for the fix.
By the way, if you're always prompted to log into SharePoint and then are successful, and you have a fully qualified DNS hostname, this is usually an Internet Explorer problem. It typically happens with full DNS names because they're not part of the Intranet zone by default. Just go to Internet Options and add the server to your Intranet zone and the prompts will go away.
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.
- 10.10.10.1 - 10.10.10.254
- 172.22.0.1 - 172.22.0.254
- 192.168.10.1 - 192.168.10.254
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 in
SharePoint's explorer view and for some open and save dialog boxes.
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.
- Visual Studio SharePoint Power Tools - This adds enhanced support for sandboxed solutions to Visual Studio. Specifically, it adds a Sandboxed version of the Visual Web Part (the original Visual Web Part required a farm solution), and it checks at compile time to be sure you're only using API calls that work in the sandbox. Download it at http://bit.ly/SPSL_PowerTools.
- SharePointLogViewer - This is a great tool for easy viewing of SharePoint logs (thanks Julie!). It's available at http://sharepointlogviewer.codeplex.com/.
- Fiddler - This is a great network tracing tool that goes beyond the browser-based tools by working for all client programs, including Microsoft Office. Get your copy at http://www.fiddlertool.com/fiddler2/version.asp
- ADO.NET Data Services Update for .NET 3.5 - This is required for SharePoint's RESTful services to work. I've often wondered why this isn't installed by the SharePoint prerequisite installer, since you really need it in production and staging as well as development. Head to http://bit.ly/SPSL_DataServicesUpdate for the download.
- SharePoint Designer 2010 - It's not just for business users! Developers can browse all SharePoint content, easily edit master pages and page layouts, create declarative workflows, BCS definitions and more. It's free from http://bit.ly/SPSL_SPDesigner64.
- Team Foundation Server - Even if you're working on your own, it's worth setting up at least TFS Basic for its versioning support. It's great to know you can easily roll back your changes, or see just what you changed since you tried radical refactoring idea. You can get a trial copy at http://www.microsoft.com/download/en/details.aspx?id=15070.
The Basic configuration is pretty light weight and requires only IIS and SQL Server (which you already have for SharePoint!) It provides source control without all the collaboration features. Setup instructions are at http://msdn.microsoft.com/en-us/library/ee259686.aspx.
- Browsers! - If your target users are using more than just Internet Explorer, load up the browsers they use.
- Beyond Compare - The ultimate file differencing tool, Beyond Compare can compare and synchronize whole file hierarchies or individual files. It isn't particular to SharePoint development, but it's a very helpful tool indeed. (No they didn't pay me to say that, and I paid the regular price for my
copy. Worth it. Thanks to my friend Bob for pointing it out years ago; I've been a fan ever since.) http://scootersoftware.com/
Shift Into Overdrive
There 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 defrag
the 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.)
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".
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!