0

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.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Iliana
  • 11
  • 2
  • Does this answer your question? [Why my WPF program cannot run without Visual Studio?](https://stackoverflow.com/questions/18933534/why-my-wpf-program-cannot-run-without-visual-studio) – Heretic Monkey Jul 25 '23 at 14:34
  • Is aword user scoped or application scoped? If its the latter the config is needed its the source of that setting. – Ralf Jul 25 '23 at 14:40
  • @Ralf It's user scope. – Iliana Jul 26 '23 at 05:39
  • @HereticMonkey No, the program can run without visual studio but not without the .config file. The video show 2 program I made, the first (older) can run alone but the 2nd require the .config file. – Iliana Jul 26 '23 at 05:39
  • You may wish to read the question and answer before judging. The answer begins "The question title is not really accurate since it's not really related Visual Studio. `MultiStart.exe` is dependent on configuration" – Heretic Monkey Jul 26 '23 at 11:59

0 Answers0