Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0 installer .NET4
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 30-Aug-12 7:18am
koleraba1.2K
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
koleraba at 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 at 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 at 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.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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"]
  Permalink  

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

  Print Answers RSS
0 CHill60 360
1 Sarvesh Kumar Gupta 213
2 OriginalGriff 193
3 Peter Leow 155
4 RyanDev 145


Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 7 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid