ClickOnce overwrite user settings (.net core 3.1)- Settings.Default.Upgrade() not working

Konstand Du Plessis 1 Reputation point

Hi all

I have a small offline wpf app making use of user settings and click once deployment.
No matter what I do, I cannot retain the user settings after clickonce updates and resets all values to defaults.
I have tried the Settings.Default.Upgrade() recommendation, but it does not work.
Settings.Default.GetPreviousVersion("propertyname") also always returns null.

I also tested this in a small desktop app, same results. is this something missing in .net core 3.1?

I am left to either throw out the use of built in user settings or click once...

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,685 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,621 Reputation points

    Hi KonstandDuPlessis-5459,
    If a previous version of the settings file exists, it will copy its value to the latest version every time the application is launched.
    In other words,ClickOnce copy user-level settings forward to the next version's cache when the user gets an update.
    For more discussion on this problem, you can refer to this thread.
    And you can try the method that Agustin Meriles provided.
    Best Regards,
    Daniel Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

  2. Konstand Du Plessis 1 Reputation point

    There is nothing strange to the code, but it still overwrites the 2 with 1 after update


    using System.Windows;

    namespace TestSettingsApp
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    public MainWindow()

        private void Button_Click(object sender, RoutedEventArgs e)
            Properties.Settings.Default.Setting = settingTxt.Text;
            settingLbl.Content = Properties.Settings.Default.Setting;
        private void Grid_Loaded(object sender, RoutedEventArgs e)
            if (Properties.Settings.Default.UpgradeSettings)
                Properties.Settings.Default.UpgradeSettings = false;
            settingLbl.Content = Properties.Settings.Default.Setting;


  3. Erick Heredia 1 Reputation point

    In case someone hasn't found a way to fix this.

    What worked for me to solve it was Sign the application in Project properties -> Singing -> "Sign the assembly"

    this even though I already sign the application when publishing in click once, then I sign the application in both places.