0

In my company users are opening applications from a network drive. To update (override) these applications every user has to close the app.

To avoid that I created a app that finds the newest version by foldername. For example:

Folder: 1.0
Folder: 1.0.1
Folder: 1.0.2
Folder: 1.2
Folder: 2.0

AppLauncher.exe

If I click AppLauncher.exe the app in the folder 2.0 launches. The problem is that the UserSettings are always lost on a new version because the application is on another filepath (versionfolder).

In this thread the solution mentioned was to strong-name the application. I can't to that because signing my app means that I have to sign all the other assemblies to. Thats not doable in my case.

Is there any other solution?

DiplomacyNotWar
  • 31,605
  • 6
  • 57
  • 75
Thomas Klammer
  • 782
  • 1
  • 11
  • 34

1 Answers1

-1

Have a look to ApplicationSettingsBase.Upgrade

This method merges previous version settings with current settings (in memory). You will probably want to save the resulting settings.

I have this code in my program.cs:

private static void Main(string[] args) {
        Properties.Settings.Default.Upgrade();
        Properties.Settings.Default.UpgradeRequired = false;
        Properties.Settings.Default.Save();
        //Other stuff
}
mnieto
  • 3,525
  • 4
  • 19
  • 35
  • 1
    That is not likely to help since the app is in a completely different directory. Without a strong name the storage location for the user.config file has a very different hash value. Upgrade() only works when the EXE assembly version is incremented. – Hans Passant Sep 19 '18 at 09:07
  • you should add if(Settings.Default.UpgradeRequired) { ..upgrade.. } – Thomas Klammer Sep 20 '18 at 06:32