Visual Studio 忘记了窗口设置并弄得一团糟

发布于 2024-07-19 05:24:06 字数 181 浏览 9 评论 0原文

我在打开 Visual Studio 时遇到这个问题,内部窗口散落各处。 它们都没有停靠; 一些应该可见的东西变得不可见了,反之亦然。 然后我必须花费很长时间才能将窗户恢复到我喜欢的位置。

它似乎只在某些解决方案中发生,并且最近才出现。

我这辈子都无法解决这个问题。 还有其他人经历过这个吗?

I have this problem where I open Visual Studio and the internal windows are scattered all over the place. None of them are docked; some that should be visible have become invisible and vice versa. I then have to spend ages getting the windows back where I like them.

It only seems to happen with some solutions and only appeared recently.

For the life of me I can't fix the problem. Has anyone else been through this?

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

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

发布评论

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

评论(12

雪化雨蝶 2024-07-26 05:24:07

Visual Studio 经常以单调的方式破坏其设置(一直都是这样,从 Visual C++ 时代起我就一直受此困扰,而且在 VS2013 中它仍然是一个问题)。

通常这看起来完全是随机的,但在碰撞后很有可能发生。

如果 Visual Studio 没有完全关闭,它也会丢失对设置的任何更改 - 由于某种原因,VS 似乎会等到它退出后才写回您的更改,而不是在您确定对话框时保存设置,因此在更改后选项 我总是退出并重新启动以确保更改已刷新到磁盘。 同样,您不应该在运行 2 个或更多 VS 实例时更改选项,因为最后一个退出的实例将覆盖设置。

特别是,有一个很容易重现的情况:如果您同时启动两个或更多副本(我的意思是,如果您启动两个或更多副本,因此它们都同时初始化),它们似乎会发生冲突覆盖设置文件,它会损坏或重置为默认值。

我发现的最好的两种解决方法是:

  • 永远不要一次启动多个实例。 如果您需要同时运行多个实例,请等待第一个实例完成加载其解决方案,然后再开始启动下一个实例。

  • 始终使用工具> 导入和导出设置将您的设置保存到备份文件中,以便每次发生这种损坏时只需几秒钟即可恢复。

另一个较小但仍然相当令人恼火的习惯是,如果 VS 在退出时最小化(例如通过关闭),它会破坏其窗口位置信息,并且下次运行它时,它将最大化。

Visual Studio corrupts its settings with regular monotony (always has done, I've been suffering from this since the Visual C++ days, and it's still a bugbear in VS2013).

Often this seems to be totally at random, but it's highly probable after a crash.

It will also lose any changes to your settings if Visual Studio doesn't shut down cleanly - for some reason instead of saving back the settings when you OK the dialog, VS seems to wait until it quits to write back your changes, so after changing options I always quit and restart to ensure the changes have been flushed to disk. Similarly you should never change options with 2 or more instances of VS running, as the last one to quit will overwrite the settings.

In particular, there is an easily reproducible case: If you launch two or more copies at the same time (by which I mean if you start up two or more copies, so they are all initialising at the same time), they seem to fight over the settings file and it becomes corrupted or resets to defaults.

The best two workarounds I've found are:

  • Never launch more than one instance at a time. If you need to run several instances concurrently, then wait for the first one to finish loading its Solution before you start to launch the next.

  • Always use Tools > Import and Export Settings to save your settings to a backup file, so that recovering from this corruption only takes a few seconds each time it happens.

Another smaller, but still rather irritating habit is that if VS is minimised when it is quit (e.g. by shutting down), it corrupts its window position information and the next time you run it, it will be maximised.

我是男神闪亮亮 2024-07-26 05:24:07

当“我的文档”文件夹存储在映射驱动器上时,我遇到了类似的问题。 如果我在映射驱动器之前打开 VS,VS 会表现得好像这是第一次打开它一样。 我通过将环境设置存储在本地磁盘上解决了这个问题。

I had a similar issue when the My Documents folder was stored on a mapped drive. If I opened VS before mapping the drive, VS would act as if it was the first time it had been opened. I solved this issue by storing the environment settings on the local disk.

辞慾 2024-07-26 05:24:07

我也刚刚遇到了这个问题(似乎在 Windows 更新后触发),无论我做什么,我都会不断得到一些虚假的窗口布局。 上述建议也没有奏效。 但幸运的是,以下建议: 为什么 VS 2008 IDE 不记住我的偏好? 删除:

%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf

有效。

TP

I just ran into this problem too (seemed to trigger after a windows update) where I kept getting some bogus window layout no matter what I did. The above suggestions didn't work either. But luckily the suggestions in: Why doesn't VS 2008 IDE remember my preferences? of deleting:

%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf

worked.

TP

暖伴 2024-07-26 05:24:07

事实上,我找出了罪魁祸首:之前的 VS 崩溃。

如果我的一个 Visual Studio 实例由于某种原因崩溃 - 下次启动 VS 时,我会得到一批奇怪的设置。 该行为取决于多种因素,例如我当时是否打开了其他 VS 实例。

Actually I worked out what the culprit was: previous VS crashes.

If one of my Visual Studio instances crashes for whatever reason - the next time I start up VS, I get a weird batch of settings. The behaviour depends on various factors, like whether or not I had other instances of VS open at the time.

掌心的温暖 2024-07-26 05:24:07

我尝试了Peter McG的解决方案,仍然没有帮助。
最终对我有用的是删除我的 VS 解决方案用户选项 (.sou)。 与我的解决方案位于同一目录中。

唯一不好的是你必须重做所有设置。 这包括我的异常更改。 不需要改变太多,但如果你有很多定制,那可能会很痛苦。
该文件中一定有什么东西弄乱了一切,但删除整个文件又快又容易。

I tried Peter McG's solution, still didn't help.
What ended up working for me was to delete my VS Solution User Options (.sou). Located in the same directory as my solution.

Only bad thing is you have to redo all of your settings. This included my exception changes. Not to much to change, but if you have a lot of customization it could be a real pain.
There must be something in that file messing everything up, but deleting the whole file is quick and easy.

淡墨 2024-07-26 05:24:07

您打开哪个解决方案并不重要,因为这些设置不是特定于解决方案的。 但我想知道你是否安装了 Visual Studio 2005 和 2008? 如果是这样,打开 2005 年创建的解决方案将打开 VS 2005,打开 2008 年解决方案将打开 VS 2008。即使您没有安装 VS 2005,也可能有它。 例如,InfoPath 2007 安装 VS 2005 shell。

首先,我会将窗口放置在您想要的位置,然后执行“工具”->“ 导出设置并仅包含窗口布局。 这样你至少就有了可以恢复的东西。

然后我会检查“工具”->“ 选项-> 导入导出设置并记下“自动将我的设置保存到此文件”路径的设置位置。 密切关注该文件。 您是否有任何同步软件可能会无意中覆盖它? 它是否指向一个不存在的位置?

Which solution you're opening shouldn't matter because those settings are not solution-specific. But I wonder do you maybe have Visual Studio 2005 and 2008 installed? If so, opening a solution created in 2005 will open VS 2005 and opening a 2008 solution will open VS 2008. You may have VS 2005 even if you didn't install it. For example, InfoPath 2007 installs a VS 2005 shell.

First I would position the windows where you want them, then do a Tools -> Export Settings and include only the window layouts. That way you at least have something you can revert to.

Then I would check Tools -> Options -> Import Export Settings and make note of where the "Automatically Save My Settings To This File" path is set to. Keep an eye on that file. Do you have any sync software that may be inadvertently overwriting it? Does it point to a non-existing location?

下壹個目標 2024-07-26 05:24:07

我的问题类似,但结果是应用程序崩溃。 问题是

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\MainWindow 中的这个值。 它被设置为“0 1000 -280 -100 3”,可能是因为有多个屏幕并且经常移动 UI。

删除此值允许应用程序成功重新启动。 它在启动时重新创建。

My issue is similar, but the result is the app crashes. The problem was this value

In HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\MainWindow. It was set to "0 1000 -280 -100 3" probably due to having multiple screens and moving the UI around a lot.

Deleting this value allowed the app to restart successfully. It gets recreated on startup.

轻拂→两袖风尘 2024-07-26 05:24:07

我面临类似的问题。 而且它也是最近才开始的,比如,在过去 30 天内左右。 我记得这段时间唯一改变的是更新 Resharper 4.5。

I'm facing similar issue. And it also only started recently, like, within the last 30 days or so. The only thing I remember changing in this period was updating Resharper 4.5.

墨离汐 2024-07-26 05:24:07

我也经历过类似的事情。 就我而言,文本编辑器颜色(例如 c# 编辑器)变得混乱。 我尝试过且对我有用的唯一解决方案是更改颜色主题,然后再回到我想要的。

I have experienced something similar. In my case the text editor colors (c# editor for example) are going haywire. The only solution that I tried and works for me is change color theme so something else and then back to what I want.

余厌 2024-07-26 05:24:07

就我而言,不是窗口布局被损坏,而是智能感知提供了代码完成和弹出帮助。 过去十年从未出现过此问题,现在每天至少出现 3 次。 Win8.1、Visual Studio 2013、ReSharper 8 和现在的 ReSharper 9(希望升级能够修复该问题)。

我现在通常必须

  • 关闭解决方案,
  • 工具/导入导出设置/重置所有设置
  • 关闭 Visual Studio
  • 打开 Visual Studio 导入我保存的设置
  • 重新打开解决方案并继续工作

然后我可以再次正常工作相当长的一段时间,直到出现问题错误...可以说我在调试时出现了堆栈溢出。 那时我只知道我的设置被搞砸了,我的智能感知又死了。

我开始怀疑这是否与最新的 Visual Studio 更新有关。 里面有一些我从来没有用过的东西,比如广告垃圾和 Office 开发集成。 MS Office 有其自身的问题,例如 Office 64 位无法被任何其他应用程序(例如 Quicken)视为已安装的电子邮件程序。 或者可能是与 ReSharper 的冲突,ReSharper 想要超越并“扩展”Intellisense 功能。

无论哪种方式,我确信它是同一问题的不同表现:Visual Studio 设置在正常使用期间会横向移动。

In my case its not the Window layout being corrupted but Intellisense offering code completion and pop-up help. Never had this issue for the last decade, now it happens 3 times a day at least. Win8.1, Visual Studio 2013, ReSharper 8 and now ReSharper 9 (in hopes the upgrade would fix it).

I now routinely have to

  • close the solution,
  • Tools/Import-Export Settings/Reset all settings
  • Close Visual Studio
  • Open Visual Studio Import my saved settings
  • RE-open the solution and continue working

I can then work fine again for quite some time until something goes awry... lets say a stack-overflow while I'm debugging. At that point I just know my settings are screwed and my Intellisense is dead again.

I'm starting to wonder if it isn't something to do with a latest Visual Studio update. There are things in there I never use like the advertising crap and Office development integration. MS Office has its own issues, like Office 64 bit not being seen by any other application such as Quicken as an installed email program. Or maybe its a conflict with ReSharper which wants to overtake and 'extend' the Intellisense feature.

Either way, I'm sure its a different manifestation of the same issue: Visual Studio settings are going sideways during normal use.

不必在意 2024-07-26 05:24:07

我刚刚在 VS 2012 中遇到这个问题,重置窗口布局没有任何作用。

我将

%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf

推断为

%appdata%\Microsoft\VisualStudio\11.0\Windows.index

...删除它并恢复正常!

  • 确保先关闭 VS 的所有实例!

I just came across this issue in VS 2012, reset window layout was doing nothing.

I extrapolated

%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf

to

%appdata%\Microsoft\VisualStudio\11.0\Windows.index

... deleted it and was back in business!

  • Make sure you close all instances of VS first!
独留℉清风醉 2024-07-26 05:24:06

听起来 Visual Studio 在往返之间保留您的设置肯定存在问题,并且可能一般情况下您的 Visual Studio 设置配置文件存在问题。

我建议的解决方案是首先重置所有设置,其次根据您的个人喜好自定义内容,最后备份这些自定义设置。 我们的想法是,稍后可以使用此设置备份文件自动将设置快速恢复到您满意的位置。 以下步骤展示了如何执行此操作,希望能够解决最令人困惑的 Visual Studio 设置问题:

  1. 关闭 Visual Studio 的所有实例。

  2. 转到开始> 节目> Visual Studio 200X > Visual Studio 工具 > 并选择“Visual Studio 200X 命令提示符”

  3. 运行不太知名的“devenv.exe /ResetUserData”命令。 使用此命令,您将丢失所有 Visual Studio 环境设置和自定义设置。 因此,/ResetUserData 开关不受官方支持,并且 Microsoft 也没有宣传它(在命令提示符中键入 devenv.exe /? 时获得的 devenv.exe 帮助中没有描述该开关)。 重要的是,等待生成的 devenv.exe 进程从任务管理器甚至更好的 Process Explorer 中消失。

  4. 当进程从任务管理器或进程资源管理器中消失时,运行“devenv.exe /ResetSettings”,这将恢复 IDE 的默认设置并最终启动 Visual Studio 的单个实例。

  5. 现在,在 Visual Studio 中,选择“工具”菜单底部附近的“导入和导出设置...”,启动导入和导出设置向导。

  6. 选择“重置所有设置”单选按钮,然后单击“下一步”> 选择“否,只是重置设置,覆盖我当前的设置”,然后下一步> 选择您个人的“设置集合”首选项,我会在此处选择 Visual C# 开发设置(注意:您在此处选择的内容会影响键盘快捷键等,但您可以随时重复此过程,直到满意为止),然后单击“完成”。

  7. 当您收到“您的设置已成功重置为 XXXXXX 开发设置”的消息时。 单击“关闭”,然后花大量时间向 Visual Studio 添加任何个人自定义设置,例如打开您始终想要打开的窗口、自定义工具栏和添加任何工具栏按钮等。

  8. 当您完成个人自定义并对您的设置再次转到“工具”>“ “导入和导出设置...”

  9. 选择“导出选定的环境设置”单选按钮,然后单击“下一步”> 勾选“所有设置”并下一步> 选择文件名和目录,然后单击“完成”,将当前设置的备份存储在 .vssettings 文件中。

  10. 将来如果事情再次变得混乱,请返回“工具”> “导入和导出设置...”,这次选择“导入选定的环境设置”单选按钮,然后选择“下一步”> 选择“否,只需导入新设置,覆盖我当前的设置”,然后“下一步”> 从列表中选择 .vssettings 文件的名称(通常在“我的设置”文件夹下)或“浏览...”到保存文件的位置,然后单击“下一步”>“下一步”。 勾选“所有设置”并单击“完成”。

  11. 重要的是,关闭 Visual Studio 的单个实例。 您将来打开的任何实例都应保留最新的自定义设置。

Sounds like there is definitely a problem with Visual Studio retaining your settings between round-trips and possibly your Visual Studio settings profile in general.

The solution I'd recommend is firstly to reset all settings, secondly customize things to your personal preference and finally take a backup of those customized settings. The idea is that this settings backup file can be used later to automate a quick settings restore to a point you are happy with. The following steps show how to do this and hopefully should sort out even the most confused Visual Studio setting issues:

  1. Close down all instances of Visual Studio.

  2. Go to Start > Programs > Visual Studio 200X > Visual Studio Tools > and choose 'Visual Studio 200X Command Prompt'

  3. Run the sligthly less well known 'devenv.exe /ResetUserData' command. With this command you will lose all of your Visual Studio environment settings and customizations. Because of this, the /ResetUserData switch is not officially supported and Microsoft does not advertise it (the switch is not described in the help for devenv.exe you get when you type devenv.exe /? in a command prompt). Importantly, wait for the resulting devenv.exe process to disappear from Task Manager or even better Process Explorer.

  4. When the process disappears from Task Manager or Process Explorer, run 'devenv.exe /ResetSettings' which will restore the IDE's default settings and eventually start a single instance of Visual Studio.

  5. Now in Visual Studio choose 'Import and Export Settings...' near the bottom of the 'Tools' menu to start the Import and Export Settings Wizard.

  6. Choose 'Reset all settings' radio button and Next > Choose 'No, just reset settings, overwriting my current settings' and Next > Choose your personal 'Settings Collection' preference, I would choose Visual C# Development Settings here (Note: What you choose here has an effect on keyboard shortcuts etc. but you can always repeat this process until happy) and click Finish.

  7. When you get the message that 'Your settings were successfully reset to XXXXXX Development Settings.' click Close then spend a good bit of time adding any personal customizations to Visual Studio such as opening windows you always want open, customizing toolbars and adding any toolbar buttons etc.

  8. When you are finished with your personal customization and completely happy with your setup go again to Tools > 'Import and Export Settings...'

  9. Choose 'Export selected environment settings' radio button and Next > Tick 'All Settings' and Next > Choose a file name and directory and click Finish to store a backup of your current settings in a .vssettings file.

  10. In future if things go haywire again head back to Tools > 'Import and Export Settings...' and this time choose 'Import selected environment settings' radio button and Next > Choose 'No, just import new settings, overwriting my current settings' and Next > Either choose the name of your .vssettings file from the list (usually under the My Settings folder) or Browse.. to where you saved the file and Next > Tick 'All Settings' and click Finish.

  11. Importantly, close the single instance of Visual Studio. Any future instance you open should retain your latest customizations.

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