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?

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
Tommehh
  • 872
  • 1
  • 17
  • 44
  • Can you try copying the folder and saving it with different name? That may replicate the user settings as well – ManishM Sep 19 '18 at 08:37
  • Brr, way to dig an ever deeper hole. Strong-naming is too simple to not consider. Programmers tend to assume it requires a certificate and code-signing, it doesn't. – Hans Passant Sep 19 '18 at 09:06
  • How can I strong-name without code-signing? – Tommehh Sep 20 '18 at 06:30

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,744
  • 4
  • 21
  • 37
  • 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.. } – Tommehh Sep 20 '18 at 06:32