Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a project that builds and has a post build event. The post build event copies the output DLL to a directory F. The system is supposed to place all DLLs in the F drive. In my system, I cannot partition my drive to add an F drive, so I mapped a dummy F folder to be the F drive.

F drive -> \\<PC IP>\C$\F\

When I build the solution using Visual Studio 2008 the post build event is successful. But when I try to build the solution using command line msbuild, it fails and says that the "Specified drive does not exist". Any idea how to trick the powershell into believing the F drive exist? I can navigate to the F drive using Windows explorer properly and as I said earlier the post build event succeeds when using the IDE.

The powershell command line used:

msbuild MySolution.sln /p:Configuration=Debug /p:Platform="Any CPU"

Note that my system is a Windows 7 Professional. I tried to do the same msbuild using Windows XP and there is no problem. I ran the command prompt with Administrator rights too.

share|improve this question
up vote 2 down vote accepted

If you want to fake a drive letter on a local computer use SUBST instead of mapping a network drive.

From Subst /?:

Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]
SUBST drive1: /D

  drive1:        Specifies a virtual drive to which you want to assign a path.
  [drive2:]path  Specifies a physical drive and path you want to assign to
                 a virtual drive.
  /D             Deletes a substituted (virtual) drive.

So you should be able to use something like c:\> subst F: C:\F.

Also ensure you are subst'ing the drive (or mapping it) in the same user space as Powershell/MSBuild is running in. If you map a drive as the local user, and MSBuild is running 'as Administrator' it won't be able to see your user mapped drive (and vise versa).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .