Share via

Clickonce user settings not carrying over

Cody Eidsness 20 Reputation points
2026-05-28T00:42:19.26+00:00

Upgrading a vb .net windows forms project from .net 4.8 to .net 10. Everytime I publish an update my user settings are lost. From research it looks like I need to make a strong name key for the project, but the build properties are not showing in my project properties. I tried making a blank project as well and cannot find where to sign the assembly to get the user settings to stay

User's image

Update: I see the option when making a c# winforms application, but not a vb.net winforms application

Developer technologies | .NET | Other
0 comments No comments

Answer accepted by question author

Nancy Vo (WICLOUD CORPORATION) 4,765 Reputation points Microsoft External Staff Moderator
2026-05-28T06:10:10.68+00:00

Hello @Cody Eidsness ,

Thanks for your question.

Since the UI option is missing in VB.NET, we do it manually by editing the project file directly.

  1. Generate a strong name key file by opening Developer Command Prompt for Visual Studio and run:
sn.exe -k MyAppKey.snk

This creates a file called MyAppKey.snk. Then copy this .snk file into your project folder.

  1. Edit .vbproj
  • In Visual Studio, right-click your project in Solution Explorer
  • Click Unload Project
  • Right-click again → Click Edit .vbproj
  • Find the first <PropertyGroup> section and add these two lines inside it:
<PropertyGroup>
  <SignAssembly>true</SignAssembly>
  <AssemblyOriginatorKeyFile>MyAppKey.snk</AssemblyOriginatorKeyFile>

</PropertyGroup>
  • Save the file
  • Right-click project -> click Reload Project.
  1. Include the .snk file in your project.
  • In Solution Explorer, click Show All Files button
  • Find MyAppKey.snk
  • Right-click it → Include in Project

Even with signing, .NET needs you to tell it to migrate old settings.

  1. Adding NeedToUpgrade setting by:
  • Go to Project -> Properties -> Settings
  • Add a new setting:
    • Name: NeedToUpgrade
    • Type: Boolean
    • Scope: User
    • Value: True
  1. Call Upgrade() on first run after update by opening your ApplicationEvents.vb or Form1.vb and adding this code:
If My.Settings.NeedToUpgrade Then
    My.Settings.Upgrade()
    My.Settings.NeedToUpgrade = False
    My.Settings.Save()
End If
  1. Please republish with ClickOnce

For more information, you can refer to these documents:

I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.

Was this answer helpful?

2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.