How to find the directory path for msi during installation
-
Hi, I needed to find the path of the MSI file through which i am installing the s/w.I needed to check certain file's path during installation(when Installer class is called ... How can i get the path of the msi file from where the Installation initiated?. Please Help...
-
Hi, I needed to find the path of the MSI file through which i am installing the s/w.I needed to check certain file's path during installation(when Installer class is called ... How can i get the path of the msi file from where the Installation initiated?. Please Help...
Get it from where ? Within the MSI ? You can;t write MSIs in C#, can you ? What I tend to do, is write my install path in the registry, so that other apps can find it later if need be, such as patches.
Christian Graus Driven to the arms of OSX by Vista.
-
Get it from where ? Within the MSI ? You can;t write MSIs in C#, can you ? What I tend to do, is write my install path in the registry, so that other apps can find it later if need be, such as patches.
Christian Graus Driven to the arms of OSX by Vista.
I think U didn't get me.. I just wanted to know a whether flie (like name 'abc')is in the same folder/path from where my installation package executed. I am using custom installation during which at a time i needed to look for this file if exist ignore else create.. I wanted to add this check when i call Install method..
-
I think U didn't get me.. I just wanted to know a whether flie (like name 'abc')is in the same folder/path from where my installation package executed. I am using custom installation during which at a time i needed to look for this file if exist ignore else create.. I wanted to add this check when i call Install method..
What install method ? You say you're calling an install method, but you're talking about MSIs in a C# forum. So, are you using C# to write an MSI ? Are you calling some other sort of method, called install, that runs an MSI ? Are you talking about a C# program, or a process within the MSI ?
Christian Graus Driven to the arms of OSX by Vista.
-
What install method ? You say you're calling an install method, but you're talking about MSIs in a C# forum. So, are you using C# to write an MSI ? Are you calling some other sort of method, called install, that runs an MSI ? Are you talking about a C# program, or a process within the MSI ?
Christian Graus Driven to the arms of OSX by Vista.
This is the code which i am talking about.. the position i mentioned in the code there i need to find the path for that specified file before calling that Configuration form .. i have to create MSI for my project.. using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using System.IO; using System.Reflection; namespace Trade.CustomInstallation { [RunInstaller(true)] public partial class CustomInstallation : Installer { public CustomInstallation() { InitializeComponent(); } public override void Install(System.Collections.IDictionary stateSaver) { "Here I need to Check for the File " ConfigurationForm frmConfig = new ConfigurationForm(); frmConfig.ShowDialog(); base.Install(stateSaver); } protected override void OnAfterUninstall(System.Collections.IDictionary savedState) { base.OnAfterUninstall(savedState); //This method is used to delete all the files after uninstallation. string rootPath = string.Empty; string clientPath = string.Empty; DirectoryInfo directoryInfo = Directory.GetParent(Assembly.GetExecutingAssembly().Location); string currentDirectory = directoryInfo.ToString(); char[] separator = { '\\' }; string[] pathArray = currentDirectory.Split(separator); //condition for Single drive like c:\ if (pathArray.Length == 2 && string.IsNullOrEmpty(pathArray[1])) { rootPath = currentDirectory + "Root"; clientPath = currentDirectory + "Client"; } else { rootPath = currentDirectory + @"\Root"; clientPath = currentDirectory + @"\Client"; } string[] subDirectories = Directory.GetDirectories(currentDirectory); for (int subDirectoryCount = 0; subDirectoryCount < subDirectories.Length; subDirectoryCount++) { //Delete Root Folder if (rootPath.Equals(subDirectories[subDirectoryCount])) Directory.Delete(rootPath, true); //Delete Client Folder if (clientPath.Equals(subDirectories[subDirectoryCount])) Directory.Delete(clientPath, true);
-
This is the code which i am talking about.. the position i mentioned in the code there i need to find the path for that specified file before calling that Configuration form .. i have to create MSI for my project.. using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration.Install; using System.IO; using System.Reflection; namespace Trade.CustomInstallation { [RunInstaller(true)] public partial class CustomInstallation : Installer { public CustomInstallation() { InitializeComponent(); } public override void Install(System.Collections.IDictionary stateSaver) { "Here I need to Check for the File " ConfigurationForm frmConfig = new ConfigurationForm(); frmConfig.ShowDialog(); base.Install(stateSaver); } protected override void OnAfterUninstall(System.Collections.IDictionary savedState) { base.OnAfterUninstall(savedState); //This method is used to delete all the files after uninstallation. string rootPath = string.Empty; string clientPath = string.Empty; DirectoryInfo directoryInfo = Directory.GetParent(Assembly.GetExecutingAssembly().Location); string currentDirectory = directoryInfo.ToString(); char[] separator = { '\\' }; string[] pathArray = currentDirectory.Split(separator); //condition for Single drive like c:\ if (pathArray.Length == 2 && string.IsNullOrEmpty(pathArray[1])) { rootPath = currentDirectory + "Root"; clientPath = currentDirectory + "Client"; } else { rootPath = currentDirectory + @"\Root"; clientPath = currentDirectory + @"\Client"; } string[] subDirectories = Directory.GetDirectories(currentDirectory); for (int subDirectoryCount = 0; subDirectoryCount < subDirectories.Length; subDirectoryCount++) { //Delete Root Folder if (rootPath.Equals(subDirectories[subDirectoryCount])) Directory.Delete(rootPath, true); //Delete Client Folder if (clientPath.Equals(subDirectories[subDirectoryCount])) Directory.Delete(clientPath, true);
I didn't know you could write an msi in C#. So, all you need is System.IO.File.Exists to see if a file exists already ?
Christian Graus Driven to the arms of OSX by Vista.