Watts
Watts

Reputation: 35

VS2008 Setup Project - Portability

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?

Upvotes: 0

Views: 695

Answers (2)

Watts
Watts

Reputation: 35

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.

Upvotes: 1

David Gladfelter
David Gladfelter

Reputation: 4213

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.

Upvotes: 1

Related Questions