A
A Nonymous
I am trying to implement a web updater for my C# application. I am
using a technique I have used for several years in Win32 apps but it
isn't working for the .NET version of my app.
This is my process:
1. My app retrieves a version file form our web server and compares the
version to the version of the current assembly. Works fine.
2. If an update is available, I download the new Setup.exe from the web
server and save it in a folder under My Documents. Works fine.
3. I start the setup and close my app. Works fine.
4. At this point setup should perform the upgrade and then launch the
new version. This is where it fails.
Apparently the Setup.exe does not have permission to copy the new exe
into the \Program files\My App\ folder.
If I launch Setup.exe by double clicking on it, it works fine. As I
mentioned before I have been using this technique with the same
installer for several years with my Win32 applications.
I have included the subroutine that actually spawns setup.exe below.
This is actually the version I originally started with. I have tried
MANY variations and nothing works except launching with a specific user
and password. For testing I hard coded my info, but for a released app
it needs the credentials of the current user not mine and I can't figure
out how to get the current users password...
How can I spawn setup with the same permissions as the current user from
my C# app?
private void miHelpCheckForUpdates_Click(object sender, EventArgs e)
{
frmHelpCheckForUpdates CFU = new frmHelpCheckForUpdates(CFG,
_SerialNumber);
if (CFU.ShowDialog() == DialogResult.OK)
{
if (CFU.UpdatesDownloaded)
{
ProcessStartInfo SI = new ProcessStartInfo();
SI.FileName = CFG.DownloadPath + CFU.NewVersionSetupFile;
SI.WorkingDirectory = CFG.DownloadPath;
SI.UseShellExecute = false;
Process P = Process.Start(SI);
Close();
}
}
}
using a technique I have used for several years in Win32 apps but it
isn't working for the .NET version of my app.
This is my process:
1. My app retrieves a version file form our web server and compares the
version to the version of the current assembly. Works fine.
2. If an update is available, I download the new Setup.exe from the web
server and save it in a folder under My Documents. Works fine.
3. I start the setup and close my app. Works fine.
4. At this point setup should perform the upgrade and then launch the
new version. This is where it fails.
Apparently the Setup.exe does not have permission to copy the new exe
into the \Program files\My App\ folder.
If I launch Setup.exe by double clicking on it, it works fine. As I
mentioned before I have been using this technique with the same
installer for several years with my Win32 applications.
I have included the subroutine that actually spawns setup.exe below.
This is actually the version I originally started with. I have tried
MANY variations and nothing works except launching with a specific user
and password. For testing I hard coded my info, but for a released app
it needs the credentials of the current user not mine and I can't figure
out how to get the current users password...
How can I spawn setup with the same permissions as the current user from
my C# app?
private void miHelpCheckForUpdates_Click(object sender, EventArgs e)
{
frmHelpCheckForUpdates CFU = new frmHelpCheckForUpdates(CFG,
_SerialNumber);
if (CFU.ShowDialog() == DialogResult.OK)
{
if (CFU.UpdatesDownloaded)
{
ProcessStartInfo SI = new ProcessStartInfo();
SI.FileName = CFG.DownloadPath + CFU.NewVersionSetupFile;
SI.WorkingDirectory = CFG.DownloadPath;
SI.UseShellExecute = false;
Process P = Process.Start(SI);
Close();
}
}
}