I am trying to run some custom actions code for windows service (the service is LocalSystem account) with windows service installer and i get the following error message:
error message while installing MSI:
Error 1001. An Exception occurred in the OnAfterInstall event handler
of System.ServiceProcess.ServiceInstaller. --> Access to the path XXX
is denied.
this code is throwing the error:
protected override void OnAfterInstall(IDictionary savedState)
{
string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
System.IO.File.WriteAllText(path, "test");
}
At the code i am trying to access the service .exe directory so i could delete the files created there
My goal is to make a custom action for the install/uninstalling process. i want to delete files that was created after installation like logs and configuration file.
Thanks