Storing VS projects on a Network drive

I have a centralized file server where I store pretty much all of my data. When I got my file server I moved all my data to it including my Visual Studio projects. This was about a year ago. 

I figured I could easily map a network drive and load up the projects and work on them from there. However, it didn't work as smoothly as I would have liked it to. For what ever reason about 1/3rd of the time when I save a file (that is on my network drive) Visual Studio hangs anywhere from 10-45 seconds. As you could imagine this gets very annoying very quickly. Since then I gave up the idea of running my projects from my network drive.

Today I was updating an old project that was on my network drive and I figured it should be rather quick so I would try to run the project from the network drive. That was a mistake! Almost every time I saved or built my project I got the 10-45 second hang of Visual Studio. It was really quite frustrating.

I figured that someone else out there must have had the same problem before so I did my usually google research but I didn't come up with anything clean cut. I did however run across a newsgroup posting about a similar problem with Office and Visual Studio. That post pointed to MSDN's Configuring Opportunistic Locking in Windows knowledgebase article. I was so frustrated that I figured hey why not I will give it a try.

I set the registry keys on my file server and I figured the change would take place immediately because usually if it requires a restart the knowledgebase article would say that but this article didn't. After testing it I still had the problem, Grrrrr... I didn't really want to reboot my entire server so instead I just quickly restarted my Server service, hoping that this would fix the problem. Much to my delight it did fix the problem ;)

So anyways the moral of the story is if you want to run Visual Studio projects from a network drive but are having problems with Visual Studio hanging while saving files then you might want to consider setting the registry keys from the above knowledgebase article and remember to restart the server (at least the Server service).

I hope this saves someone else the pain of dealing with this problem.

7 Comments

  • There are other problems with doing things from network drives, though. For example, memory-mapped files don't behave very well over a network (if your application uses them). Services don't like being run from networked drives (they don't even like being run from drives created with the SUBST command). And, most importantly, .NET applications that are run from networked drives get less privileges than ones run from local drives. So you might be getting Access Denied error when you don't want to, or wouldn't normally need to.

  • Lord: I'm not talking about running VSS from a network that wasn't the problem. I'm actually talking about storing the actual files on the network.



    Dean: You are correct that it is not a good idea in general but I usually only need it for small projects or web applications. Today I used it to work on an ASP.NET web application that was actually hosted on the file server, so it works pretty well for that, at least now it does. Also since my network consists of only my computer, my wife's computer and the server I just enabled full-trust for my intranet access, so I don't have a CAS problem.

  • If you're wanting backup facilities by storing them on the network drive, look into source control.



    I'm using Subversion with Tortoise/Ankh which gives me fast local and compiling and then I can commit changes to the server.



    Not only do you effectively get the backup on the server but you get a full change log and can revert/roll back individual files, all from the comfort of the VS IDE.



    [)amien

  • Damien: Actually I do have source control for most of my projects. I use SourceGear Vault it works quite well for my needs. My issue is not one of backup necessarily, it is more an issue that I have a network drive (sort of like my home directory) that is mapped and I stored (and may store again) visual studio projects there.

  • Did you disable Opportunistic locking or did you just change the MinLinkThroughput, MaxLinkDelay or OplockBreakWait?

    p.s. it now says you need to restart the computer.

  • For my Windows 2003 Server I just set "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" - EnableOplocks to 0.

  • Lifesaver. I was having VS2008 hang for > 15 minutes until I read this ...

Comments have been disabled for this content.