I have a windows application installed and working perfectly fine.
Something weird came up, the test scenario is if I rename the config file from the original name which is:
Model Label PC Client.exe.config
...to:
xxxModel Label PC Client.exe.config
...and click the .EXE file on the application folder / path where i installed it, it works as expected.
But when I clicked the shortcut icon of this application on the desktop, it shows a pop up that installs a new copy of the correct config file name.
please refer to the screenshot , any idea how to prevent this from happening? or is this really the behavior?
CodePudding user response:
"any idea how to prevent this from happening?"
For installed apps, it is by design. Essentially you have removed an installed file and so the installer tech will kick in to recover it as if nothing happened.
Now technically you could get around that auto-recovery by not using MSI tech to install your app trusting instead on good-ol' XCOPY but then again, renaming/moving/deleting the file may break the app because this time there is no auto-recovery!
Additionally .NET apps expect to find a .config file matching the same name as the executable so you shouldn't go renaming/deleting/moving it in most scenarios.