Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
您好,我使用以下代码重新启动我的 WPF 应用程序
System.Diagnostics.Process.Start(Application.ResourceAssembly.Location) Application.Current.Shutdown()
但是我注意到当它再次运行时 My.Settings 值被重置为默认值,知道如何防止这种情况吗?
确保在重新启动之前在设置上调用 Save()。如果您已经在应用关闭过程中执行此操作,则设置文件可能会被新应用实例锁定,从而阻止当前实例保存。