0

I'm writing a desktop application in .NET 6 and using the User Settings feature to store some persistent configuration values. Because the application is portable, I sign the assembly with a strong name, so that if the executable changes location the user settings are still the same (like explained here). I use strong naming in Visual Studio with the following configuration:

strong naming settings

Then I publish the application to a folder via Visual Studio with the following profile settings:

publish profile settings

If I run the application, the user settings are saved with its path as identifier instead of the strong name.

But if I publish the application without the 'Produce single file' option activated, it will output the DLL's, runtime config and executable separately. If I run the application now, then the user settings are saved with the strong name as identifier.

Also, if I verify the files with the Strong Name Tool (sn -v) via the Visual Studio Developer Command Prompt, the DLL's are valid (the executable is not, but I think that is expected).

I expected the same when publishing to a single file. What changes with this option? And how do I get the same result as publishing to separate files?

FreakyTorial
  • 1
  • 1
  • 2
  • That could work in .NETCore 3 but not in 5+, it now loads assemblies directly from the single file instead of extracting the assemblies to disk. You can force 3 behavior by setting the IncludeAllContentForSelfExtract project file property to true. – Hans Passant Dec 27 '22 at 12:32
  • @HansPassant Thank you very much! Now it is working as expected. – FreakyTorial Dec 27 '22 at 12:53

0 Answers0