Visual Studio:调试时重置用户设置
在 C# Winforms 应用程序中,我存储了多个用户设置。
每次我从 Visual Studio 2008 开始调试项目时,是否有一种简单的方法可以清除这些设置?
否则,它始终以上次调试会话的设置启动。
In a C# Winforms-App I have several user settings stored.
Is there an easy way to clear those settings each time I start debugging the project from Visual Studio 2008?
Otherwise it always starts up with the settings from the last debug-session.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
有同样的问题,在这里找到了答案:
https://stackoverflow.com/a/2117359/488794
仅当您满足以下条件时,您才可以使用以下语句进行重置:调试:
已测试 VS2012 .Net 4.0 (参考)
Had the same question and found an answer here:
https://stackoverflow.com/a/2117359/488794
You can use this following statement to only reset if you're debugging:
tested VS2012 .Net 4.0 (Reference)
添加要删除的预构建操作:
%USERPROFILE%\Local Settings\Application Data\[AppName]\...\[Version]\user.config
或者如果您的版本号发生很大变化,只需删除
%USERPROFILE%\Local Settings\Application Data\[AppName]\
Add a pre-build action to delete:
%USERPROFILE%\Local Settings\Application Data\[AppName]\...\[Version]\user.config
or if your version number changes alot just delete
%USERPROFILE%\Local Settings\Application Data\[AppName]\
添加到上述答案,这里有一个适用于大多数设置的复制粘贴解决方案:
请注意,在大多数情况下,最好删除 %localappdata%[公司名称] 下的所有内容。检查存储在那里的应用程序数据并选择最适合您的。
Adding to the above answers, here a copy-paste solution that works for most settings:
Note that for most cases it's best to delete everything under %localappdata%[company name]. Check the app data stored there and choose what's best for you.
运行->输入“appdata”
导航到本地->/
删除与项目相关的所有文件
Run->Type "appdata"
Navigate to Local->/
Delete all files related to the project
以下是两种可能的方法:
使用预构建或后构建事件命令行,将删除命令等放入其中或运行批处理文件或脚本
使用启动项目的“启动操作”选项,您可以使用要运行的命令行参数指定外部程序首先
Here are two possible ways to do it:
use either the pre build or post build event command line, you put delete commands and such in there or run a batch file or script
have a play with the Start Action options of the start up project, you can specify an external program with command line arguments to be run first
基于其他答案:只需在
C:
或C:\Users\
中搜索user.config
并删除或重命名它文件。Based on other answers: just search on
C:
orC:\Users\<YourUser>
foruser.config
and delete or rename that file.