views:

153

answers:

2

When I add a file to my setup deployment project, Visual Studio won't allow me to edit the "SourcePath" to resolve an environment variable like $(DLL_PATH). It adds the file with the source path on my local machine and builds fine locally. When the same project is built on another machine, it won't work unless that machine also has the exact same path to files needed.

I want the SourcePath to resolve the $(DLL_PATH) so as long as a machine has it defined correctly the MSI package will build fine.

Not sure about the subst, since I have no control over what the other build machine looks like. If I try to assign a known directory to a virtual drive, it could possibly fail right?

A: 

Your best bet is to use subst.exe or a junction point to create a virtual directory. See here for information on junction points. Subst.exe simply creates a virtual drive letter. Put all of the deployable files in some directory tree with well-defined, constanct sub-paths, and make the root of that tree a junction point or virtual drive.

David Gladfelter
I don't have any knowledge of the other build machine, is it safe to be creating virtual drives on a build machine with subst.exe?
Watts
You need to know that the build machine doesn't have that drive letter already assigned. You should be sure to do a subst.exe /u to unassign it when the script completes. Other than that, you're golden.
David Gladfelter
You'd think they would let you do something to edit the path of the files. I am adding a script to copy the files from the variable location into the project output folder before the setup.exe is built, then add them from there. I think subst would work as well, but I'm not certain of the setup on the build machine so it isn't 100% effective.
Watts
A: 

Actually what I did was setup a script.cmd to run after my project output is built to copy the dependencies to a folder that is relative to the actual project folder from the declared $(DLL_PATH). The setup project actually uses relative paths to the project, not absolute ones. So this works no matter what the build machine looks like. Then a script to remove this folder at the end.

Watts