Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi
I am using the visual studio installer project to develop installer package for a desktop application. I am using custom actions to enable the user to provide some additional information used to configure the installed application. I also want to support silent (unattended) installations. In that case the user should provide the xml file holding the necessary info. Since I don't want to force the user to store the file on the pre-defined location, I need to retrive the location of the installer package within my custom action and check if that folder contains the xml file. So far I was unable to find a way to retrive the location of the msi package. Any ideas would be appreciated

Uros
Posted

The initial problem you have is that the MSI gets copied to the windows\installer directory before it gets executed

Have a look at the SourceDir[^] property
 
Share this answer
 
Comments
koleraba 3-Sep-12 9:24am    
Hi
If I understand you correctly that means that even I could retrive the file path of the installer package, that location would always point to windows\installer directory and original location of the installer would be lost. Do you have any other ideas on how to accomplish the desired functionality?
barneyman 5-Sep-12 4:04am    
I *think* sourcedir is what you want ... failing that, run the msi with full logging (/l* logfile?) and see if any of the properties have the right value
koleraba 5-Sep-12 11:55am    
I have some problems accessing the sourcedir property from my custom action. Do you know how can I access that property. I am using c# 4.0.
Described problem can be solved by the following steps:

-In visual studio right-click your installer project and select view->custom actions
-Right click the custom action for the phase(install, uninstall..l) in which you need to access the source directory of your msi project and select properties
-Enter the following line under CustomActionData:
/sourcedir="[SOURCEDIR]\"
Now the source dir in your custom action can be accessed by the following line:
Context.Parameters["sourcedir"]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900