Until now I could use an exe file alone to run some home made exe. For resources, I use the NuGet costura.fody package to include them in the exe. So I have a single file: myprogram.exe and it works on its own.
However, on my latest application, I've noticed that it's no longer working. When I only keep the exe, something happens (mouse waiting) and then nothing. After a few tests, I noticed that deleting the myprogram.config file prevented it from working.
This file contains the application settings I use to store user choices such as window location.
Previously, the file was automatically created in C:\Users[USERNAME]\AppData\Local[APPNAME][APPNAMEEXTENTED[APPVERSION] and was called user.config.
But this is no longer the case: the file that stores the information is in the same place as the exe and is called [APPNAME].config.
What has caused this change and what can I do to get it back to the way it was?
There is a video with an older application and a newer: https://www.youtube.com/watch?v=0ddsfj_WrCw&feature=youtu.be
For example, I create a new application : New project --> Application WPF (.NET Framework) --> Target Framework 4.8.1.
Just a simple textbox and a button:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void loaded(object sender, RoutedEventArgs e)
{
tbx.Text = Settings.Default.aword;
}
private void Clic_Apply(object sender, RoutedEventArgs e)
{
Settings.Default.aword = tbx.Text;
Settings.Default.Save();
}
}
Build debug --> 3 files :
- testconfig.exe
- testconfig.exe.config
- testconfig.pdb
If I delete the textconfig.exe.config file, the application can't run.