Reputation: 1418
I followed this link http://www.codeproject.com/Articles/19560/Launching-Your-Application-After-Install-using-Vis & it has given a good guid to my problem. But in my scenario, I also have a folder with the exe. after installation my exe starts running. but it is not properly linked with the conetent in my folder which is also in same location. How can I link that folder to my exe.
The problem is I added both folder & its contents to Application folder directory given by the setup project wizard. But I can add only the exe to the commit folder as I want my exe to run after after clicking on first initial exe. How ever after first installation both my exe & folder creates & when I click on exe manually it works. But in installation it only copies exe & folder & start running copied exe but could nt find the folder properly.
Upvotes: 0
Views: 2999
Reputation: 2651
The working directory of your exe will be different when launched as a commit action.
You either need to change the working directory in your exe or build an absolute path to the folder you are trying to find.
You could pass the application path from the installer to your exe by setting CustomActionData
to '[TARGETDIR]\'
, or extract it from the exe path at runtime, e.g.:
string exepath = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
string abspath = Path.Combine(exepath, "yoursubfolder");
Upvotes: 1
Reputation: 48558
I think this is what you want
http://blogs.msdn.com/b/astebner/archive/2006/08/12/696833.aspx
Upvotes: 0