如何为每个 DLL 实例创建 1 个 .NET 设置
我的服务是一个DLL,可以多次安装。 DLL 的设置存储在Settings.settings 中。 DLL 的每个实例都有自己的 Settings.settings。这可以通过 Settings.settings 来完成,还是我必须创建自己的配置方案?如果可能的话,我想避免重新发明轮子。我不一定需要单独的文件,只需一种允许我为 DLL 的正确实例加载正确设置的机制。
My service is a DLL and it can be installed multiple times. The DLL has its settings stored in Settings.settings. Each instance of the DLL will have its own Settings.settings. Can this be done with Settings.settings, or do I have to create my own configuration scheme? I want to avoid reinventing the wheel if possible. I don't have to necessarily have separate files, just a mechanism for allowing me to load the correct settings for the correct instance of the DLL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您可以使用将安装在与您的服务相同的目录中的 app.config: http://www.codeproject.com/KB/dotnet/dllappconfig.aspx
perhaps you could use an app.config that will get installed in the same directory as your service: http://www.codeproject.com/KB/dotnet/dllappconfig.aspx