对应用程序设置的更改在运行时不显示
我有一个应用程序正在处理运行时必须操作的所需文件列表。我想向此列表添加几个文件。文件列表存储在设置中。设置的范围是“应用程序”。我将两个文件添加到列表中(通过项目属性 -> 设置),并保存所有内容。我的文件现在出现在那里。我的文件显示在该项目的 app.config 中的 ApplicationSettings 下。
但是当我运行应用程序时,这行代码:
StringCollection requiredFiles = mySettings.UpdatePackageRequiredFiles;
不包括我的文件。
mySettings
是正确的类型;这是设置所在的项目。此外,项目中没有任何地方正在写入 UpdatePackageRequiredFiles,并且您无论如何都无法在运行时写入应用程序范围设置(或者我是这么理解的)。
为了给这个谜团增添一点趣味,列表中出现了 3 个文件,它们的存在完全是个谜。在设计器或源文件中查看设置时,它们不会出现。那么我错过了什么?
I have an application that's dealing with a required list of files it has to manipulate when run. I wanted to add a couple of files to this list. The list of files is stored in a setting. The scope of the setting is "Application". I added my two files to the list (via project properties -> settings), and saved everything. My files now appear there. My files are showing up in the app.config for this project under ApplicationSettings.
But when I run the application this line of code:
StringCollection requiredFiles = mySettings.UpdatePackageRequiredFiles;
Does not include my files.
mySettings
is the right type; it's the project where the settings exist. Further, there is nowhere in the project UpdatePackageRequiredFiles is being written to and you can't write to an Application scope setting at run-time anyway (or so I understand).
To spice up the mystery a little bit, there are 3 files appearing in the list whose existences are a complete mystery. They do not appear when viewing the settings in the designer, or in the source file. So what am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,有一个配置文件具有相同名称的设置,应用程序可以从中获取文件列表。
It turns out there is a configuration file with an identically named setting that the application was getting the list of files from.