在myproject.exe.config发布后对myproject.exe.config进行更改时,设置值未更新 [英] Settings value not updated when changes is being made to myproject.exe.config after it had been published

查看:73
本文介绍了在myproject.exe.config发布后对myproject.exe.config进行更改时,设置值未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提前感谢您的帮助。这就是发生的事情,当我在发布应用程序后更改app.config中的值时,我可以看到该值正在更新。但是,当我将应用程序(没有myproject.exe.config)复制到笔记本电脑中的其他位置时。该值未更新(仍与发布的值相同)。



为简化起见,请允许我提供一个示例:



发布时 - 用户名= admin的值



然后我将用户名的值更改为管理员



如果应用程序在同一文件夹位置使用myproject.exe.config运行,则需要新的用户名(管理员)



但是,如果应用程序在没有myproject.exe.config的情况下运行,换句话说,只有应用程序保留在该文件夹中,它将采用旧用户名(admin)



如何使得即使myproject.exe.config不在该目录中,应用程序仍将采用最新值?

Thanks in advance for any help. This is what happened, when I changes the value in app.config after I had published the application, I can see that the value is being updated. However, when I copied the application (without the myproject.exe.config) to some other location in my laptop. The value is not being updated (still the same value as those being published).

To make things simpler, allow me to provide an example:

when it is published- value for username = admin

then I went to change the value for username to administrator

if the application is run with myproject.exe.config in the same folder location, it will take the new username (administrator)

However, if the application is run without myproject.exe.config, in other words, only the application remain in that folder, it will take the old username(admin)

How can I make it such that even if the myproject.exe.config is not in that directory, the application will still take the latest value?

推荐答案

嗯...构建过程这样做



* .cs(等)(来自你的项目)+ app.config =你的project.exe和您project.exe.config



所以我会部署'your project.exe.config'而不是app.config



你不发布任何关于如何使用新值更新配置的代码 - 但只要'你的project.exe.config'与'your project.exe'在同一个目录中就应该能够手动编辑(例如记事本,记事本++)'你的project.exe.config'并查看更改
well ... the build process does this

*.cs (etc) (from your project) + app.config = your project.exe and your project.exe.config

So I would be deploying 'your project.exe.config' not app.config

you dont post any code about how you update the config with the new value - but as long as 'your project.exe.config' is in the same directory as 'your project.exe' you should be able to manually edit (eg notepad, notepad++) 'your project.exe.config' and see the change


这篇关于在myproject.exe.config发布后对myproject.exe.config进行更改时,设置值未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆