I’ve developed a Windows Forms
app in VS2022
which has a couple int-typed User Settings
so that when the user modifies certain parameters their values are saved and loaded in the next app execution. This has generated an App.config
xml file in my project with Build Action->None
and Copy to Output Directory->Do not copy
properties.
When I publish my app (with publish option Produce single file
), 3 files are generated in my output directory: the .exe
, a .pdb
and a .dll.config
file.
If I move the .exe
to a different folder it throws the following exception when I launch it:
System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize`
So it appears to be dependent on being in the same directory as the .dll.config
file.
I’ve tried setting App.config
s Build Action
to Embedded Resource
but it still throws the exception, is there a workaround to this dependency?