Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.Net app.config file ignored when under c:\ProgramFiles\

I have a strange phenomen

I have .Net 4.0 app. When the myapp.exe.config is under the normal programfiles folder it is ignored. Even if I delete it or write nonsense in it the myapp.exe works and it seems to me that values are taken from a previous installation.

When I copy the folder to e.g. to Desktop it works correct.

Edit: when I copy form c:programfiles\myapp\ to c:\programfiles\copy of myapp\ it works It seems to be only a problem in the progamfile folder where a previous installation has benn made. (I guess)

Any ideas?

Best regards

like image 860
woax Avatar asked Oct 09 '22 08:10

woax


2 Answers

Could you share your operating system with us? I have had similar problems in the past with an application (Win 2008). One simple work arround if you are not the system administrator, is to edit the .config file on another location, and then place it back.

Sometimes the content of a file is not really editted, however a copy is created with your changed on the back, which is confusing.

like image 53
dannl Avatar answered Oct 13 '22 12:10

dannl


Most probably you are dealing with a case of "compatibility files" - in your Program Files folder you have a file saved in the Compatibility files view that is being read instead of your actual file.

Delete the compatibility files and everything should work correctly.

enter image description here

In this article, in the "how about the ugly part?" you will find described exactly your scenario.

Best regards

like image 31
Ando Avatar answered Oct 13 '22 11:10

Ando