Tuesday, June 30, 2009

AddFromTemplate has misleading documentation

When building a custom solution template, it's sometimes useful to programmatically execute other templates. In our case, we have a unit test project template that we'd like to call from the domain template. To do this, you use a method off of ENVDTE90.Solution3 called AddFromTemplate, which takes among other things, the path to the template, the output directory, and the new project name.

The documentation for this method says this about the project name parameter:
"The name of the project file in the destination directory. This should include the extension."

Seems pretty clear about whether or not to include the extension, right?

The first version of our wizard included the extension. Unfortunately, this resulted in the $safeprojectname$ parameter ending up with the extension in it as well. Since this parameter is also used to define the default namespace, we ended up with test classes whose full names were something like MyApplication.MyProjectTests.csproj.MyClassTests. Yuck.

The solution appears to be to completely disregard the documentation and don't include the extension. So far this appears to be working.

Wednesday, June 03, 2009

How to access a Virtual PC from the Host

Most of the documentation I've seen for Virtual PC describes how to setup the virtual machine itself to be able to access the network. I have an application server installed on a virtual, though, that I'd really like to be able to access from the host machine.

This took some digging to find, but this article was exceptionally helpful. The only extra step I had to take was to disable Windows Firewall on the virtual machine so it would let the network traffic through.