I have a custom action that runs as a Visual Studio Installer Projects deployment.
Is it possible to specify the working directory of this custom action, relative to the installation directory?
Edit
To clarify
I have an installer project that runs a program as a custom action. I want to specify the working directory of that program from within the installer project, so when the program runs during installation, it will run with the Working directory I specified at the time of creating the installer.
Working Directory: Is this an EXE custom action? Custom actions in Visual Studio Installer Projects run in
deferred mode, system context
- meaning they run asSystem
/LocalSystem
. I am honestly not sure what that does to the "working folder
". I would assume it just means the working folder is wherever the executable is running from.VS Installer Project Limitations: Visual Studio Installer Projects lack the ability to configure advanced settings altogether. There is a way to run an EXE file and specify a working folder, but it is not supported by these projects. I am also not sure if this would solve your problem before we know what you are actually running. It could be a script. There are several major problems with these installer projects.
Custom Action: A Type 34 Custom Action allows you to
Run an EXE file having a path referencing a directory
. You either need to hotfix your output MSI with Orca or use a real-deployment tool such as WiX or an equivalent commercial options. Though I have not tried, WiX should be capable of doing what you want - as should all the other, major commercial options.Hotfixing: Hotfixing the MSI is somewhat involved meaning you have to add entries to the
CustomAction Table
and theInstallExecuteSequence Table
. You should not need to add the binary to the Binary Table if it is a file you want to run after it is installed or it is a file that exists on disk already. There are a number of flags you need to set for the custom action columnType
which relates to whether the action runs synchronously or asynchronously, whether you want to abort on error or not, what sequence it will run in and that kind of stuff. You combine bit fields.