Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > Change working directory for a custom action
 

Change working directory for a custom action

I have a custom action that is an EXE. I am deploying it to a subfolder within my Application Folder. I can then create a Custom Action (in the Commit group) that calls my EXE. This results in the following being executed...

"C:\Program Files\My Application\lib\executable.exe"

Instead, I need to do something like...

"cd C:\Program Files\My Application\lib\"

"executable.exe"

It is really frustrating that I have to do this, but unfortunately the EXE is part of a driver install for a 3rd Pary compoment, and I can't control how it functions.

Any help would be greatly appreciated.

Hacker_2003  Tuesday, February 19, 2008 9:23 PM

How are you calling that exe? If you doCreateProcess call on the exe then set the lpCurrentDirectory parameter to that lib folder. If you use a .NET Process class you'd use a ProcessStartInfo and set the WorkingDirectory property.

PhilWilson  Wednesday, February 20, 2008 8:06 PM

In Visual Studio 2005 there is Post-Build events which can run *.exe

You will find this on the main property page under the Manafacturer info and other details.

Look at this:

  1. Open or create a setup/deployment project in Visual Studio 2005
  2. Press F4 to display the Properties window
  3. Click on the name of your setup/deployment project in the Solution Explorer
  4. Click on the PostBuildEvent item in the Properties window to cause a button labeled "..." to appear
  5. Click on the "..." button to display the Post-build Event Command Line dialog
  6. Add a command line of your choice in the Post-build event command line text box
  7. Build your project in Visual Studio and verify that the post-build event is executed after the main MSI build

(from: http://blogs.msdn.com/astebner/archive/2006/08/24/716145.aspx)

lorneJones  Wednesday, February 20, 2008 8:10 AM

I don't want my EXE to be executed after I build (i.e. post-build). I want it to be executed as part of the install.
Hacker_2003  Wednesday, February 20, 2008 8:00 PM

How are you calling that exe? If you doCreateProcess call on the exe then set the lpCurrentDirectory parameter to that lib folder. If you use a .NET Process class you'd use a ProcessStartInfo and set the WorkingDirectory property.

PhilWilson  Wednesday, February 20, 2008 8:06 PM

You can use google to search for other answers

Custom Search

More Threads

• Looking for click-once like solution
• Does "ClickOnce" download the entire application every-time I update it?
• Clickonce error when installing
• Publishing with Visual Studio 2008 Express gives errors when I publish with prerequisites from install location
• how to make a custom dialog on which I can add controls by my requirement ?
• Configuring SQL Server when included as a requirement
• Change Update Location at Client Side
• Custom file type in click once
• redistributable package for Office 2007 Data Connectivity Components?
• Clickonce, only one manifest file