How to Get the MSI installer Path
-
Hi I have created a .NET application with a custom installer, that all works fine. After the installation process I need to access a file that is located inside the folder where the MSI installer / setup is located. The problem I have is I cannot work out how to get the path for the MSI installer / setup. Can anybody please help and advice me the best way to get this path while I am still inside the "Commmited" of the installer vb.net or C# either will be fine. Thanks
-
Hi I have created a .NET application with a custom installer, that all works fine. After the installation process I need to access a file that is located inside the folder where the MSI installer / setup is located. The problem I have is I cannot work out how to get the path for the MSI installer / setup. Can anybody please help and advice me the best way to get this path while I am still inside the "Commmited" of the installer vb.net or C# either will be fine. Thanks
you can use the SourceDir property of the Windows Installer. You can pass this info as a CustomAction in your deployment project :
/SrcDir="[SourceDir]\"
You can then use it in c# with :this.Context.Parameters["SrcDir"]
or in vb with :Me.Context.Parameters("SrcDir")
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
-
Hi I have created a .NET application with a custom installer, that all works fine. After the installation process I need to access a file that is located inside the folder where the MSI installer / setup is located. The problem I have is I cannot work out how to get the path for the MSI installer / setup. Can anybody please help and advice me the best way to get this path while I am still inside the "Commmited" of the installer vb.net or C# either will be fine. Thanks
Your installer should not be accessing files from the folder that the .MSI was launched from. Any files it needs should be inside the .MSI itself. Windows Installer, AFAIK, doesn't have a facility to tell the code inside an .MSI where it was launched from.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
Your installer should not be accessing files from the folder that the .MSI was launched from. Any files it needs should be inside the .MSI itself. Windows Installer, AFAIK, doesn't have a facility to tell the code inside an .MSI where it was launched from.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...I beg to differ. We often use Active Directory to roll out updates and installs company-wide. It is a common requirement to pick up some client specific customisation data which they supply in an xml file accompanying the msi. When installing the same update across multiple clients it would be impractical to do a specific build for each client containing their special data to roll out to the end users.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
-
I beg to differ. We often use Active Directory to roll out updates and installs company-wide. It is a common requirement to pick up some client specific customisation data which they supply in an xml file accompanying the msi. When installing the same update across multiple clients it would be impractical to do a specific build for each client containing their special data to roll out to the end users.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
Fair enough. We just never do that around here. In our apps, we have client specific information in the users metadata in our databases. No need to send an XML file with each install.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
Fair enough. We just never do that around here. In our apps, we have client specific information in the users metadata in our databases. No need to send an XML file with each install.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...I have to say the only bit we let them customise at this point is the webservice URL of their server. We said to them, just tell your end users what to type in when it is prompted on first run. Not an accepted, but as they say, 'the client is always right', at least until they pay the invoice.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
-
I have to say the only bit we let them customise at this point is the webservice URL of their server. We said to them, just tell your end users what to type in when it is prompted on first run. Not an accepted, but as they say, 'the client is always right', at least until they pay the invoice.
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
Thankfully, just about all of my work in internal. I don't have very many clients on the outside and don't have to customize anything for a client before it goes out the door. :thumbsup:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009... -
you can use the SourceDir property of the Windows Installer. You can pass this info as a CustomAction in your deployment project :
/SrcDir="[SourceDir]\"
You can then use it in c# with :this.Context.Parameters["SrcDir"]
or in vb with :Me.Context.Parameters("SrcDir")
If you have knowledge, let others light their candles at it. Margaret Fuller (1810 - 1850) [My Articles] [My Website]
Thank you very much, worked great