This is not meant to be a sales pitch for VMware or Passport drives. I have nothing to do with their companies beyond being a user of their products. I just think that a lot of people new to software development aren't (a) aware of some tools out there and (b) aware of real-world pitfalls to avoid. This is also going to sound a bit like a blog entry, because some of it is being written as I re-install my development PC. A little real-world, real-time life sharing - mixed in with years of hard-earned lessons. What could be better?
Let's talk about documents for a moment. The good people at Western Digital make a really nice USB powered portable drive called a Passport. Seagate makes the GoDrive. Maxtor some other USB powered drive. Whatever your choice, get one; a big one. They all tell you this is the place to back up your documents from your desktop. Personally I find this to be 180 degrees backwards. I use my Passport for my live documents, and I back up to my PC hard disc daily and weekly. And here's why... I travel. When I am at my home PC, Visual Studio and Outlook and iTunes [...] look for their files on the K: drive. If I have to go on the road and work from my laptop: Visual Studio and Outlook and iTunes [...] all look to the K: drive... If I have to go to the corporate office and work from there Visual Studio and Outlook and iTunes [...] all look to the K: drive... Do you see a pattern of simplicity forming here? If you have to go to a client's location you just take the drive with you, instead of worrying about copying all the files... "Did I forget anything?" isn't a fear any more.
While we are talking about documents and backups... Do backups! Alot! I do a backup of my current Visual Studio project before every "next step", meaningful change attempt, and the top of every hour. Period. Hard drives are cheap; get over it. Nothing feels as satisfying as totally screwing up that big change you tried to make and saying "Oh well, don't care if I did just destroy the project. I have it backed up. I'll just try again with a new approach."Every time you release a version: Keep it. You don't know how often I've been saved when someone said "it worked in 1.5.0, but is broken in 1.7.5" and I could go look at the older version and find the difference.
Since all your Visual Studio projects are on the external K: drive - I want you to back up that entire drive to a folder on your desktop PC every week. Don't look at me like that. Just do it. I guarantee that at some point the portable drive will die, get run over, lost by airport luggage handlers, be hit by cosmic rays, or used by your daughter as a bath tub toy. When you are done with that... Zip up your current project and stash it on some hidden part of your personal website, cyber-existance, whatever. If your house burns down you can still earn a living if you have your code.
I don't know about you, but I find myself having to format and re-install my development PC every 8 months or so. Part of that is the never ending parade of new hardware (and thus drivers and control software) that I have to work on. Part of it is just development... causes crash and ugly reboots... Part of that is... well... Come on: It's Windows! Annual re-installation is the norm if you actually use your PC.
This last time was the switch from one anti-virus product to another. It slowed my system to a crawl and uninstalling it just didn't bring it back. We all know the drill... Install... restart... continue... restart... install... restart... download updates... set preferences... Now it's on to the applications. In the end its an entire day lost from coding so you can watch progress bars.
I've used VMware to test on for a long time. It's great to test on WinXP32, WinXP64, Win2k, Win7... and not have 5 boxes in my office. Plus Visual Studio will let you debug in those virtual machines! And when you are done testing you just restore the V.M. to the last snapshot.
Then something hit me with this latest need to re-build my PC. "What if the PC's OpSys was nothing more than a host to a Virtual Machine, and all my real applications and working life were in that V.M.?" The live O.S. (known as the host) would become nothing more than a hardware control layer. No programs. No web browsing. No damaging effects from day-to-day use. It seemed almost too good to be true. I must be missing something. Then I realized that I could keep multiple VM installs for different purposes, like having a host of PC's each configured for a different need. Yet all with the 8 gigs of RAM and 4 screens that my one machine enjoys. Wow - having several machines with all that power, for the cost of just one machine. Cool!
If I ever had to rebuild the host OS again, it wouldn't be such an ordeal since it was *just* the OS. The working environment with applications would be safely separate from that in its own harddrive file. I was almost giddy with excitement at the prospect of what this might do for me. Tempered with the fear of what tis might do to me.
Now for the best part... You can have VMware automatically restore your Virtual Machine to a specific snapshot each time it starts up. Stop and think about the implications of that. What would it be like if you spent hours building the perfect development PC... set all your preferences for Windows and every application... everything is pristine and clean and fast... And you never had to loose that? What if every day you booted up it was still that pristine 1st day? That is what I was after.
So here's what I did, and what I learned from this grand experiment. I hope it helps you.
On a fresh harddrive (so I don't loose my existing installation) I installed a totally fresh copy of Win7x64, and all the drivers for my hardware. No updates, no language packs, no B.S. Just a trim working fast O.S.
Plus one program: VMwareWorkstati on. That's it. This installation has one purpose in life: To be the hardware layer. No other programs go here.
TIP: Set your screen background to something bland. Later in your virtual machine you will use a different background. It helps a lot to tell which machine you are using.
In VMware I then made a new Virtual Machine of Win7x64.
This is going to be your every-day working environment so take some time to personalize it. Set your Windows preferences and so on. Do all your on-line updates. Make the O.S. right because this is the office you are going to work in. Once you have made a really nice O.S. make a copy of this file (preferably to another harddrive). You now have a starting point for any other Virtual Machines with all your preferences, Windows already activated, updated, personalized.
In it, I installed Visual Studio 2010 and all the supporting products like InstallShield, DotFuscator, nArrange, ReSharper... all the usual suspects for a development PC. At this point take a Snapshot in VMware. At any time a Snapshot can be restored. It's like a safepoint in Windows, only it actually works because your VMware harddrive is just a file - and we all know you can copy a file.
So at this point we have:
A host O.S. that is little more than a hardware control layer.
A Virtual Machine that we personalized and installed Visual Studio
A USB portable drive with our documents.
Question: But will it work as nicely as I had hoped? Let's start with a small test: A new Windows forms project. Just to see that everything works, preferences are set, and Visual Studio will perform with anything like reasonable speed to actually earn a living on.
Answer: YES! And not just work, but be snappy. Every bit as fast as running on a 'real' O.S., maybe even faster without the host or virtual being burdened with tons of other stuff, obsolete drivers, 20 programs all calling home to see if there are updates, etc. etc.
Next Test: Can we make this virtual machine see the host machine's K: drive as it's own K: drive so all the projects still work and retain their paths to other assemblies? Before we starting futzing with settings like shared folders and so on... Let's take a Snapshot within VMware. Just so we can roll back to this nicely working setup we have.
This one is a little tricky, but not too much. VMware has a feature called "Shared Folders". You can select folders on your host machine to share with your virtual machine. All of the folders you share on the host, regardless of actual drive or location, will appear on the in virtual machine as a folder on network share Z: That doesn't exactly work for our needs. We need to see K:\\projects\my ProjectFolder for example as just that. Not Z:\\Shared Folders\K\Proje cts\myProject folder. So what do we do?
Share the folder in VM so it appears in the shared directory Z:
In your virtual machine, map a drive to Z:\\Shared Folders\K\, and assign that mapped network share to... drum roll... K:
Now your paths match up! Ta da!
Let's talk about documents for a moment. The good people at Western Digital make a really nice USB powered portable drive called a Passport. Seagate makes the GoDrive. Maxtor some other USB powered drive. Whatever your choice, get one; a big one. They all tell you this is the place to back up your documents from your desktop. Personally I find this to be 180 degrees backwards. I use my Passport for my live documents, and I back up to my PC hard disc daily and weekly. And here's why... I travel. When I am at my home PC, Visual Studio and Outlook and iTunes [...] look for their files on the K: drive. If I have to go on the road and work from my laptop: Visual Studio and Outlook and iTunes [...] all look to the K: drive... If I have to go to the corporate office and work from there Visual Studio and Outlook and iTunes [...] all look to the K: drive... Do you see a pattern of simplicity forming here? If you have to go to a client's location you just take the drive with you, instead of worrying about copying all the files... "Did I forget anything?" isn't a fear any more.
While we are talking about documents and backups... Do backups! Alot! I do a backup of my current Visual Studio project before every "next step", meaningful change attempt, and the top of every hour. Period. Hard drives are cheap; get over it. Nothing feels as satisfying as totally screwing up that big change you tried to make and saying "Oh well, don't care if I did just destroy the project. I have it backed up. I'll just try again with a new approach."Every time you release a version: Keep it. You don't know how often I've been saved when someone said "it worked in 1.5.0, but is broken in 1.7.5" and I could go look at the older version and find the difference.
Since all your Visual Studio projects are on the external K: drive - I want you to back up that entire drive to a folder on your desktop PC every week. Don't look at me like that. Just do it. I guarantee that at some point the portable drive will die, get run over, lost by airport luggage handlers, be hit by cosmic rays, or used by your daughter as a bath tub toy. When you are done with that... Zip up your current project and stash it on some hidden part of your personal website, cyber-existance, whatever. If your house burns down you can still earn a living if you have your code.
I don't know about you, but I find myself having to format and re-install my development PC every 8 months or so. Part of that is the never ending parade of new hardware (and thus drivers and control software) that I have to work on. Part of it is just development... causes crash and ugly reboots... Part of that is... well... Come on: It's Windows! Annual re-installation is the norm if you actually use your PC.
This last time was the switch from one anti-virus product to another. It slowed my system to a crawl and uninstalling it just didn't bring it back. We all know the drill... Install... restart... continue... restart... install... restart... download updates... set preferences... Now it's on to the applications. In the end its an entire day lost from coding so you can watch progress bars.
I've used VMware to test on for a long time. It's great to test on WinXP32, WinXP64, Win2k, Win7... and not have 5 boxes in my office. Plus Visual Studio will let you debug in those virtual machines! And when you are done testing you just restore the V.M. to the last snapshot.
Then something hit me with this latest need to re-build my PC. "What if the PC's OpSys was nothing more than a host to a Virtual Machine, and all my real applications and working life were in that V.M.?" The live O.S. (known as the host) would become nothing more than a hardware control layer. No programs. No web browsing. No damaging effects from day-to-day use. It seemed almost too good to be true. I must be missing something. Then I realized that I could keep multiple VM installs for different purposes, like having a host of PC's each configured for a different need. Yet all with the 8 gigs of RAM and 4 screens that my one machine enjoys. Wow - having several machines with all that power, for the cost of just one machine. Cool!
- A VM for strictly development that only had Visual Studio
- A VM for every-day-needs with a mix of programs.
- etc.
If I ever had to rebuild the host OS again, it wouldn't be such an ordeal since it was *just* the OS. The working environment with applications would be safely separate from that in its own harddrive file. I was almost giddy with excitement at the prospect of what this might do for me. Tempered with the fear of what tis might do to me.
Now for the best part... You can have VMware automatically restore your Virtual Machine to a specific snapshot each time it starts up. Stop and think about the implications of that. What would it be like if you spent hours building the perfect development PC... set all your preferences for Windows and every application... everything is pristine and clean and fast... And you never had to loose that? What if every day you booted up it was still that pristine 1st day? That is what I was after.
So here's what I did, and what I learned from this grand experiment. I hope it helps you.
On a fresh harddrive (so I don't loose my existing installation) I installed a totally fresh copy of Win7x64, and all the drivers for my hardware. No updates, no language packs, no B.S. Just a trim working fast O.S.
Plus one program: VMwareWorkstati on. That's it. This installation has one purpose in life: To be the hardware layer. No other programs go here.
TIP: Set your screen background to something bland. Later in your virtual machine you will use a different background. It helps a lot to tell which machine you are using.
In VMware I then made a new Virtual Machine of Win7x64.
This is going to be your every-day working environment so take some time to personalize it. Set your Windows preferences and so on. Do all your on-line updates. Make the O.S. right because this is the office you are going to work in. Once you have made a really nice O.S. make a copy of this file (preferably to another harddrive). You now have a starting point for any other Virtual Machines with all your preferences, Windows already activated, updated, personalized.
In it, I installed Visual Studio 2010 and all the supporting products like InstallShield, DotFuscator, nArrange, ReSharper... all the usual suspects for a development PC. At this point take a Snapshot in VMware. At any time a Snapshot can be restored. It's like a safepoint in Windows, only it actually works because your VMware harddrive is just a file - and we all know you can copy a file.
So at this point we have:
A host O.S. that is little more than a hardware control layer.
A Virtual Machine that we personalized and installed Visual Studio
A USB portable drive with our documents.
Question: But will it work as nicely as I had hoped? Let's start with a small test: A new Windows forms project. Just to see that everything works, preferences are set, and Visual Studio will perform with anything like reasonable speed to actually earn a living on.
Answer: YES! And not just work, but be snappy. Every bit as fast as running on a 'real' O.S., maybe even faster without the host or virtual being burdened with tons of other stuff, obsolete drivers, 20 programs all calling home to see if there are updates, etc. etc.
Next Test: Can we make this virtual machine see the host machine's K: drive as it's own K: drive so all the projects still work and retain their paths to other assemblies? Before we starting futzing with settings like shared folders and so on... Let's take a Snapshot within VMware. Just so we can roll back to this nicely working setup we have.
This one is a little tricky, but not too much. VMware has a feature called "Shared Folders". You can select folders on your host machine to share with your virtual machine. All of the folders you share on the host, regardless of actual drive or location, will appear on the in virtual machine as a folder on network share Z: That doesn't exactly work for our needs. We need to see K:\\projects\my ProjectFolder for example as just that. Not Z:\\Shared Folders\K\Proje cts\myProject folder. So what do we do?
Share the folder in VM so it appears in the shared directory Z:
In your virtual machine, map a drive to Z:\\Shared Folders\K\, and assign that mapped network share to... drum roll... K:
Now your paths match up! Ta da!
Comment