从另一个程序集访问用户设置 [英] Acces User Settings from another assembly
问题描述
大家好,
好奇的问题.我以为这是一件容易的事,但是我有点挣扎.
我的C#.net 3.5应用程序解决方案由一个主机exe项目和许多其他库项目组成.显然,我的应用程序设置是在主机项目中配置的,但是我很想从其他项目中调整某些用户设置(userSettings部分组),而不必理会主机exe.我唯一可以找到的是ConfigurationManager类,但是看起来我必须指定配置文件路径才能访问用户配置.没有找到配置文件就无法访问用户设置吗?
干杯,
克里斯.
Hi guys,
Curious problem. I thought this was an easy thing to do but I''m struggling somewhat.
My C# .net 3.5 application solution is made up of a host exe project and a number of other library projects. Obviously my application settings are configured in my host project but I would quite like to adjust some of the user settings (userSettings section group) from within the other projects without having to bother the host exe. The only thing I can find is the ConfigurationManager class but that looks like I have to specify a config file path to access the user configuration. Is there no way to access the user settings without locating the config file?
Cheers,
Chris.
推荐答案
本文可能会对您有所帮助.
类库项目的配置文件 [
This article might help you out.
Configuration Files for Class Library Projects[^]
Good luck!
最后,我以本文为起点.这不是我真正想要的,但这是一个合理的折衷.
http://msdn.microsoft.com/en-us/library/ms134265.aspx [ ^ ]
In the end I have used this article as a starting point. it''s not what I wanted really, but it''s a reasonable compromise.
http://msdn.microsoft.com/en-us/library/ms134265.aspx[^]
这篇关于从另一个程序集访问用户设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!