Hi everyone,
I have a win application that creates a xml file in runtime in the setup folder path of itself. I have created a setup for my application, but i do not know how can i delete that xml file before the application is uninstalled!!!
I have tried Installer class but it did not worked. I think the problem is that in BeforeUninstall event of it the setup folder path of the application is disposed.
Note : I have used the following code to find the setup folder of my application..
using Microsoft.Win32;
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Installer\Assemblies");
string regfilepath="";
if (key!=null)
{
foreach(string Keyname in key.GetSubKeyNames())
{
if (Keyname.IndexOf("YOUR_EXE_FILE.EXE")>0)
{
regfilepath=Keyname;
break;
}
}
}
string fullpath="";
for (int a=0;a<regfilepath.Length;a++)
{
if (regfilepath.IndexOf("|",a,1)>0)
fullpath+="\\";
else
fullpath+=regfilepath.Substring(a,1);
}