Hello,
I have a C# solution with a setup project. When I install or install on a another computer, the installation path is not takeing. The setup install is always on
C:\
eg: if the user selects
c:\tools\MyProgam
, the setup installs the package on
c:\
For information, in my solution I have a custom action, and I change the defaultLocation.
namespace GestionnaireTaches_Virtuel.Install
{
[RunInstaller(true)]
public partial class GTVInstaller : Installer
{
#region Ctor(s)
public GTVInstaller()
{
InitializeComponent();
}
#endregion Ctor(s)
#region Public override Method
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
string installFolder = Context.Parameters["TARGETDIR"];
stateSaver.Add(INSTALLPATH, installFolder);
UnRegisterDLL(installFolder, "TEST.DLL");
RegisterDLL(installFolder, "TEST.DLL");
}
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
}
public override void Rollback(IDictionary savedState)
{
base.Rollback(savedState);
string installFolder = savedState[INSTALLPATH].ToString();
UnRegisterDLL(installFolder, "TEST.DLL");
}
public override void Uninstall(IDictionary savedState)
{
base.Uninstall(savedState);
string installFolder = savedState[INSTALLPATH].ToString();
UnRegisterDLL(installFolder, "TEST.DLL");
}
#endregion Public override Method
private void UnRegisterDLL(string installFolder, string ddlName)
{
string argument = string.Format(@"/C regsvr32 /u /s {0}", Path.Combine(installFolder, ddlName));
LaunchProcess("CMD.EXE", argument);
}
internal void RegisterDLL(string installFolder, string ddlName)
{
string argument = string.Format(@"/C regsvr32 /s {0}", Path.Combine(installFolder, ddlName));
LaunchProcess("CMD.EXE", argument);
}
private void LaunchProcess(string command,string argument, bool createWindow)
{
System.Diagnostics.ProcessStartInfo processStartInfo =
new System.Diagnostics.ProcessStartInfo(command, argument);
processStartInfo.CreateNoWindow = !createWindow;
processStartInfo.UseShellExecute = createWindow;
processStartInfo.RedirectStandardOutput = !createWindow;
if (System.Environment.OSVersion.Version.Major >= 6)
{
processStartInfo.Verb = "runas";
}
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = processStartInfo;
process.Start();
process.WaitForExit();
process.Close();
}
private void LaunchProcess(string command, string argument)
{
LaunchProcess(command, argument, false);
}
}
}
Can you help me?
Thanks