Click here to Skip to main content
11,790,613 members (57,603 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C#4.0 installer .NET4

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

Posted 30-Aug-12 7:18am
Rate this: bad
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
koleraba at 3-Sep-12 9:24am

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
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:
Now the source dir in your custom action can be accessed by the following line:

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

  Print Answers RSS
0 OriginalGriff 1,154
1 Maciej Los 825
2 KrunalRohit 686
3 ppolymorphe 660
4 CPallini 621

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100