Virtual Drive Letter Mapping with ‘subst’ Command

14 02 2008


1. Introduction – Path to Common Assemblies
2. Subst Command

1. Introduction – Path to Common Assemblies

When you need to place some common references in your solutions and you don’t want to register the referenced assemblies into the GAC (because they change frequently or for whatever other reason), you can decide to act as suggested in the article Team Development with Visual Studio .NET and Visual SourceSafe on msdn at the paragraph: Use a Virtual Drive Letter for Greater Flexibility.

The article presents an easy way to have a common environment on different machines.
Often there’s the need, for a team, to agree a directory path to be reproduced on each developer machine.
For example your team could agree in placing all third parties’ assemblies in a directory named: C:\develop\common.
It will be care of each developer to create such directory on his machine and to keep it up to date with the new releases of the assemblies.

This approach requires that developers set up analogous directory structures in their working environment. They are at least required to have a directory named C:\develop\common.
What you can do is to reduce this constraint, at a certain level, by using virtual drive letter mapping.

Instead of agreeing a path that each develper is supposed to have on his own machine your team must simply agree on a drive letter name. Each developer will be free to choose the path he prefers and he will only have to map it to a virtual drive letter with the agreed name by using the subst command.

→ top of paragraph
→ top of post

2. Subst Command

The subst command serves the purpose of mapping a physical path on disk to a virtual drive letter.
Just digit subst /? at a command prompt or visit Microsoft technet command-line reference page to learn more.

The syntax is: subst [drive1: [drive2:]Path]

where drive1 is the name of the virtual drive to which you want to map a path and drive2:Path represents the path itself.

e.g.: subst G: C:\develop\common

By mapping different paths on different machines to a common drive letter you can, from this moment on, let your project files reference common assemblies using paths relative to the virtual drive: G: (see again Use a Virtual Drive Letter for Greater Flexibility).

→ top of paragraph
→ top of post








%d bloggers like this: