Settings.settings 和

发布于 2024-09-29 16:06:51 字数 515 浏览 1 评论 0 原文

我有一个 C#/.NET Winforms 应用程序,其中使用“.settings”文件存储了一些设置。因此,通过右键单击“解决方案资源管理器”中的项目并选择“属性->设置”来编辑配置。

但是,我还需要能够捕获应用程序内 SerialPort 对象引发的异常。我在网上找到了一个片段,指出

<runtime>
  <legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>

在 app.config 文件中添加 ... 可以解决此问题(确实如此)。但是:现在我的解决方案资源管理器中同时有“Settings.settings”和“app.config”文件,这导致一些开发人员编辑“app.config”而不是“Settings.settings”,从而造成很多混乱。是否可以使“Settings”类自动生成“legacyUnhandledExceptionPolicy”-app.config 文件?或者我还应该做什么?有什么建议吗?

I have a C#/.NET Winforms application which has some settings stored using A '.settings' file. So the configuration is edited by right-clicking the project in "Solution Explorer" and selecting "Properties->Settings".

However, I also need to be able to catch exceptions thrown by a SerialPort object inside the application. I found a snippet on the web stating that adding

<runtime>
  <legacyUnhandledExceptionPolicy enabled="1"/>
</runtime>

... in the app.config file would fix this (which it did). BUT: Now a have both a "Settings.settings" and an "app.config" file in my Solution Explorer, which causes some developers to edit e.g. "app.config" and not "Settings.settings" causing much confusion. Is it possible to make the "Settings" class generate the 'legacyUnhandledExceptionPolicy'-thingy the app.config file automatically? Or what else should I do? Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我们只是彼此的过ke 2024-10-06 16:06:51

我会简单地得出结论:这是不可能完成的。

I'll simply conclude that This can't be done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文