Archive for April, 2009

Using Visual Studio 2010 CTP with VMWare

// April 30th, 2009 // No Comments » // .Net, VMWare, Visual Studio

I recently need to run Visual Studio 2010 October 2008 CTP with VMWare since Microsoft Virtual PC can’t handle USB at all. For my company that is a big limitation since we have hardware locks that sits in the USB port. VMWare to the rescue!

Step one is to convert the Virtual PC image to an VMWare image. Luckily that’s an fairly easy process, if you are a lucky owner of VMWare Workstation. If not, there is a free converter tool to download from the VMWare site, but I have not tried that one for myself since I have VMWare Workstation here. Follow these steps to convert the image:

1. File -> Import or Export -> Next -> Next
2. Source Type = Other -> Next
3. Virtual Machine = select the VPC image -> Next -> then wait, takes a while
4. Source Data = Convert all disks and maintain size -> Next -> Next
5. Destination = Other Virtual Machine -> Next
6. Virtual Machine Name = whatever -> Location = Choose path -> Next
7. Import and convert (full clone) -> Next -> then wait, takes a while
8. Bridged network -> Next -> Next
9. Finish!
10. Wait for the conversion to complete. Mine took around 30 min.

Ok, that wasn’t too hard, eh? Most of the steps are the default values in the wizard. So, now we have a shiny new VMWare image ready to boot. And it will boot just fine. The “minor” problem is that the CTP expired Jan 1 2009. WT*? And there is no new CTP out yet, so what to do? You need to set back the date in the image and make sure that neither VMWare nor Vista override that setting with automatic synchronization of the date and time. After a LOT of googling and finugeling and trickery I finally got it right. Find the .vmx file for you VMWare image and add the following lines:

rtc.startTime = 1226188800
tools.syncTime = "FALSE"
time.synchronize.continue = false
time.synchronize.restore = false
time.synchronize.resume.disk = false
time.synchronize.resume.memory = false
time.synchronize.shrink = false
time.synchronize.tools.startup = FALSE

Make sure you don’t have duplicate entries. If you do, VMWare will whine when you try to boot. The cryptic number 1226188800 is a UNIX timestamp that equals Nov 09 2009, which is well within the expiration limits for the CTP.

Only a few more things to be aware of, then you should be all set. After you boot, go into the date and time settings in Vista and make sure that the “internet time synchronization” is turned off. Install VMWare tools (if it is not already there) and then go to it’s settings and double check that the time synchronization is turned off there too.

Phew! If you carefully followed the steps outlined here you will be able to run the CTP for ETERNITY! Why anyone would actually do that is beyond me, but hey, who am I to judge?

If this helped you in any way, please let me know in the comments. Thanks!

Solving Visual Studio’s trust issues

// April 8th, 2009 // No Comments » // .Net, Security, Troublesolving, Visual Studio

I use Subversion for all my code. I also like to keep my checked out code on a mapped network share since it has backup and is accessible from outside my main dev machine. With this setup you will sooner or later (probably sooner) run into the problem with Visual Studio not trusting the network share, and subsequently hitting you in the face and kicking you in the groin. To make our beloved studio behave more decent, I executed the following line of goodness into a Visual Studio Command Prompt:

caspol -machine -addgroup 1 -url file://h:/* FullTrust -name DevShare

This will put the mapped drive “h:” in the “Full Trust” group. Just replace the drive name (and perhaps choose another name than “DevShare”) with your specifics, and you should be good to go! Hopefully this will help someone. If not, you could check out the following post on StackOverflow.

Generating C# from an UML model with T4

// April 7th, 2009 // 1 Comment » // .Net, T4, Tools, UML

It would take quite a few blog entries to cover all that goes into the heading of this post. So I won’t do that :-). I’ll try to be short.

Code Generation with T4

Code Generation with T4

First some background though. I’m using a product called Enterprise Architect to do all my UML modeling. It is a decent product that is not too expensive. It has built in support for generating code in various languages, C# being one of them. Problem is the template language for the code generation sucks. Enter Visual Studio and T4! That would be T4 as in “Text Template Transformation Toolkit”, not the Terminator Salvation movie. Sorry to disappoint you there.

The short story is that T4 is a templating tool built right into Visual Studio! If you’re using VS 2008 you already have it installed. For more information and a great link resource, check out Scott Hanselman’s blog post about T4 (and also listen to his accompanying Hanselminutes podcast that covers the topic).

So basically I have created T4 templates that communicates with my UML model and generate all relevant classes and connections between them. Hopefully I will find the time to do a more complete writeup on these topics and also provide you with some code. Until then, all you need to know is that for me, T4 is a great tool!