Bonjour tout le monde,
Dans ma solution , j'ai crée des projets de fusions, un projet d'installation et un projet pour mon Installer qui a l'unique classe que voici
namespace InstallerLibrary
{
public class InstallState : System.Configuration.Install.Installer
{
public override void Commit(IDictionary savedState)
{
try
{
File.WriteAllText("c:\\test.txt","avant");
string installFolder = Context.Parameters["assemblypath"];
File.WriteAllText("c:\\test.txt",Path.GetFullPath(installFolder));
installFolder = Path.GetFullPath(installFolder);
RegistryKey key = Registry.LocalMachine;
RegistryKey configKey = key.OpenSubKey("Software\\SRCI\\AS2");
if (configKey == null)
{
key.CreateSubKey("Software\\SRCI\\AS2");
configKey = key.OpenSubKey("Software\\SRCI\\AS2", true);
configKey.SetValue("InstallFolder", installFolder);
configKey.SetValue("PartnersFolder", Path.Combine(installFolder, "Partenaires"));
configKey.SetValue("DatabasePath", Path.Combine(installFolder, "as2.mdb"));
}
else
{
configKey = key.OpenSubKey("Software\\SRCI\\AS2", true);
configKey.SetValue("InstallFolder", installFolder);
configKey.SetValue("PartnersFolder", Path.Combine(installFolder, "Partenaires"));
configKey.SetValue("DatabasePath", Path.Combine(installFolder, "as2.mdb"));
}
key.Close();
configKey.Close();
Directory.CreateDirectory(Path.Combine(installFolder, "Partenaires"));
}
catch (Exception ex)
{
throw new InstallException("Erreur de modification de la base de registre " + ex.Message);
}
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
try
{
RegistryKey key = Registry.LocalMachine;
RegistryKey configKey = key.OpenSubKey("Software\\SRCI\\AS2");
if (configKey != null)
key.DeleteSubKeyTree("Software\\SRCI\\AS2");
key.Close();
}
catch (Exception ex)
{
throw new InstallException("Erreur de modification de la base de registre " + ex.Message);
}
}
}
}
Mes méthodes ne sont jamais appelées, est ce que je dois référencer mon projet qui posséde cette classe dans un installer ou un projet de fusion ?
Merci
Afficher la suite