J'ai un projet d'installation avec une classe d'installateur personnalisée qui lance l'application à la fin de l'installation. Dans la configuration, je crée un raccourci vers la sortie de l'application. L'installation se passe bien. Mais quand je clique sur le raccourci, le programme d'installation redémarre et le lancement de l'application en même temps? Pourquoi?Problème avec le raccourci dans le projet d'installation C#
Non, le code de ma classe personnalisée est:
/// <summary>
/// Installer class to automatically launch the application at the end of the installation/
/// </summary>
[RunInstaller(true)]
public partial class InstallerStartApplication : Installer
{
/// <summary>
/// Initializes a new instance of the <see cref="InstallerStartApplication"/> class.
/// </summary>
public InstallerStartApplication()
{
InitializeComponent();
}
/// <summary>
/// Raises the <see cref="E:System.Configuration.Install.Installer.AfterInstall"/> event.
/// </summary>
/// <param name="savedState">An <see cref="T:System.Collections.IDictionary"/> that contains the state of the computer after all the installers contained in the <see cref="P:System.Configuration.Install.Installer.Installers"/> property have completed their installations.</param>
protected override void OnAfterInstall(IDictionary savedState)
{
base.OnAfterInstall(savedState);
}
// Override the 'Install' method.
public override void Install(IDictionary savedState)
{
base.Install(savedState);
}
// Override the 'Commit' method.
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
try
{
Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
Process.Start(Path.Combine(Directory.GetCurrentDirectory(), "IERssNotificator.exe"), "-c");
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
// Override the 'Rollback' method.
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
}
}
Je lance cela à l'installation et engager une action personnalisée.
Non, voir mon code ... Ci-dessus – Coolweb
Est-il possible de créer un raccourci * normal * au lieu du type qui déclenche un programme d'installation? –
Je ne l'ai pas trouvé. À la fin, j'ai créé un raccourci dans l'action Commit en utilisant WinAPI. Vous pouvez utiliser WScript.Shell ou http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp bibliothèque –