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

随声附和 提交于 2020-01-03 13:31:24

问题


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


回答1:


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.




回答2:


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.

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

Best regards




回答3:


There is a folder C:\Users\myuser\AppData\Local\VirtualStore\Program Files\myapp

Where there was the config which was taken.

This "feature" comes that my app runs not as admin. Read the comments to UAC. This happens only to Win7 and Vista. Not on XP.

regards



来源:https://stackoverflow.com/questions/8323813/net-app-config-file-ignored-when-under-c-programfiles

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!