VMWare Fusion Shared Folders and Visual Studio Development

So today I had a bit of an adventure that I figured I would document for those of you that may run into this same thing and get just as frustrated as I was for many hours trying to make this work.

I do my work on a MacBook Pro these days. My first setup was to do my .net work in a Vista VM using VMWare Fusion. I created a vmware disk to store my code, installed TortoiseSVN, and worked normally as if I were on a regular windows box. It was a nice little self-contained world.

As my usage of other tools grew, I ran into problems with this setup. Namely:

  • Tortoise is aptly named, speedwise. Especially on a VM. But also just on regular windows.
  • My files were locked away in my VM unusable by me (in an easy way) natively on the Mac OSX host. This became an issue as I started to work more and more in alternative tools, like MonoDevelop and TextMate.
  • My files were locked away in my VM unable to be explicitly backed up by TimeMachine. Less of an issue because they’re in a central source repo, but still an issue.
  • I wanted to use Git more and git-svn on windows is…slow. Also cygwin and I are not buddies yet. Plus I have a nice Terminal setup.
  • The VMdisk was big, unwieldy, not all that portable, and not all that speedy anyway.

So what I decided to do was set up a VMWare shared folder from my ~/code folder on Mac OSX, exposing it to the guest OS (Vista) as a mapped drive (z: by default). Then I cloned the svn repo with git svn to this folder, checked out a local branch, flipped to my VM, opened the project in Visual Studio, and was prompted with partial trust errors (“Project Location Not Trusted”). At first it seems like ignoring these errors will work, until you go to run some tests, and n number of tools (RhinoMocks, NUnit, SpecUnit, and so on) throw the error that the assembly does not allow partially trusted callers.

Long story short, the solution is to use caspol.exe to set the share to full trust. The documentation on this tool is terse at best, and cobbling together several blog posts (none of which got it right…) I found the command-line magic that made things work.

 

  1. Disable UAC (may not be completely necessary, but UAC sucks so do it anyway)
  2. Open a Visual Studio 2008 Command Prompt as Administrator (right-click and run as administrator) and run the following:
  3. caspol -m -ag 1.5 -url file://z:/* FullTrust

Breaking that command down a bit, you may have to substitute a couple of params. The -ag 1.5 may be different on your machine. You need to add the share (from mac osx anyway) into the “Internet_Zone” because something to do with the share path starting with a . makes Vista assume it’s in the Internet and not Intranet. To find the group number for your Internet_Zone run the command caspol -m -listgroups and look for the one that says “Zone: Trusted-Internet” (or something similar, I make no claims to Vista operating sanely across all installs). Mine was 1.5.

The second bit you may need to change is the actual share location. Mine mapped to z:/ by default, but you’ll want to check that yourself.

If all goes well you should get a message about “Added union code group with -url membership condition…” and a “success” status. All that out of the way, I reloaded Visual Studio from the share, ran tests, and they failed, but for the right reasons ;)

Related Articles:

    Post Footer automatically generated by Add Post Footer Plugin for wordpress.

    About Scott Reynolds

    Scott C. Reynolds is a developer with over a decade of experience creating enterprise solutions, primarily in healthcare and biotechnology. He is passionate about the art and craft of applying software solutions to business problems. He is a frequent speaker and participant of community events nationwide.
    This entry was posted in mac, vmware. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

    10 Responses to VMWare Fusion Shared Folders and Visual Studio Development

    1. cramsay says:

      I don’t know why I’ve never thought of this before – great post! One thing that this could also enable you to do is have a “baseline” VM snapshot which you can reset to every few days, just to keep it fresh, without having to worry about restoring all of your content, code, etc.

    2. Steve Strong says:

      I had a similar problem – posted about it here: http://blogs.imeta.co.uk/sstrong/archive/2009/01/29/589.aspx – pretty much the same experience as you, hopefully between us folks looking on Google will find the answer!

    3. @cramsay

      yeah I have a baseline VM for that, I need to redo it with this new thing done so I don’t have to deal with this again.

      @steve

      oh man I wish I had come across your post in my googling, spot on! woulda saved me hours. Hopefully now there’s two out there for people to see.

    4. alwin says:

      I had to use caspol once, but I couldn’t figure it out, then I found this:

      http://mygreenpaste.blogspot.com/2006/03/net-framework-20-configuration-tool.html

      And then used the installer from the 4th commenter.

      Now I can use mscorcfgwhich is a visual tool added to the configuration panel, same as the one in .net 1.1

    5. Peter Mounce says:

      You can get a bit of a boost by telling TortoiseSVN to only care about certain trees; Settings -> Icon Overlays -> Exclude paths & Include paths.

      Exclude c:\*
      Include c:\_source\*

      for example.

    6. cramsay says:

      Hmmm, turns out I can’t get this to work with a web project. IIS doesn’t see the mapped drive, and using the UNC path doesn’t work either – I think it could be because Parallels uses “.psf” as the name to share up my Mac.

    7. @cramsay hmm. Theoretically it should understand the mapped drive one way or the other, but I have no experience with Parallels, only Fusion. :/

    8. cramsay says:

      I tried it with VirtualBox and got the same kind of problem. Have you actually made this work (IIS & mapped drives on OSX) with VMWare?

    9. @cramsay with just the vs web server I can’t get this to work and run a website, it seems to be permissions based. I haven’t tried it with actual IIS yet, but I will try to investigate that.

      Our web development at present is primarily rails, and our .net dev is primarily winforms, so I hadn’t run into the issue naturally.

    10. @OliverOgg says:

      This is just the pain that I have been experiencing, though we are also running a web project. If I follow all of these steps and hit build, or F5 I get:

      Parser Error Message: An error occurred loading a configuration file: Failed to start monitoring changes to ‘Z:\GigJunkie\Web\MooNet.Web\MooNet.Web’.