为什么MyApp无法保存到MyApp.exe.config? [英] Why can't MyApp save to MyApp.exe.config?

查看:159
本文介绍了为什么MyApp无法保存到MyApp.exe.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我每年在VB工作几次编写应用程序以自动化我公司的各种业务流程。


当我有需要时,我总是包含.ini文件并使用网上找到的现成代码片段管理它们。对于我当前的项目(我们称之为"MyApp"),我决定使用内置的App.config函数。 一切都很好
,但是如果我在"以管理员身份运行"中启动MyApp,我的应用程序似乎只能将设置保存到MyApp.exe.config。模式。


要明确,我的登录帐户具有完全管理权限。 更令人困惑的是,我尝试更改MyApp.exe.config文件中的安全性,以明确地为"Everyone"提供完整的读/写/ mofify权限。而且,MyApp似乎
无法保存对MyApp.exe.config的更改,除非我以"以管理员身份运行"启动它。


我在这里缺少什么?  ; MyApp.exe.config与exe文件一起驻留在c:\Program Files(x86)\ MyApp\文件夹中(如果重要的话,我实际上为应用程序构建了一个InstallShield安装程序。)

解决方案

当你去我的项目 - >设置选项卡,定义的设置变量的范围是什么? 仅"用户"范围变量是读/写的(尽管如果您尝试设置应用程序作用域设置变量,您应该得到设计时错误。)


此外,您是如何尝试设置值的?  ;您使用的是什么代码?  My.Settings<变量>


I work in VB a few times per year writing apps to automate various business processes for my company.

When I have the need, I have always included .ini files and managed them using readily available code snippets found on the web. For my current project (we'll call it "MyApp"), I decided to use the builtin App.config functions.  All is well except that it seems my app can only save settings to MyApp.exe.config if I start MyApp in "Run as Administrator" mode.

To be clear, my logged in account has full administrative privileges.  Even more confusing, I tried changing the Security on the MyApp.exe.config file to exlicitly give full read/write/mofify permissions to "Everyone" and, still, MyApp seems unable to save changes to MyApp.exe.config unless I start it with "Run as Administrator".

What am I missing here?  MyApp.exe.config resides in the c:\Program Files(x86)\MyApp\ folder, along with the exe file (I actually built an InstallShield installer for the app, if that matters).

解决方案

When you go to My Project -> Settings tab, what is the scope of the defined setting variables?  Only "user" scoped variables are read/write (though you should get a design time error if you try to set an application scoped setting variable).

Also, how you are attempting to set the value?  What code are you using?  My.Settings.<variable>?


这篇关于为什么MyApp无法保存到MyApp.exe.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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