如何让用户类型 C# 语法突出显示在 VS 2012 RC 中再次工作?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10970305/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get user type C# syntax highlighting working again in VS 2012 RC?
提问by Jedidja
Somehow part of my syntax highlighting for C# code has disappeared in the VS 2012 IDE. Uninstalling, rebooting, and reinstalling does nothing, nor does resetting the colors in the options dialog.
不知何故,我的 C# 代码语法高亮部分在 VS 2012 IDE 中消失了。卸载、重新启动和重新安装什么都不做,也不会重置选项对话框中的颜色。
Here are some examples of items which all appear in default (black) that normally have color which don't:
以下是一些均以默认(黑色)显示但通常没有颜色的项目示例:
- Attributes
- System classes
- My own classes
- 属性
- 系统类
- 我自己的课
And here are some keywords that still have color:
以下是一些仍然有颜色的关键字:
- using
- public
- void
- var
- for
- 使用
- 民众
- 空白
- 无功
- 为了
Has anyone else experienced this and managed to fix it?
有没有其他人经历过这个并设法解决它?
采纳答案by GregRos
Here is a simple solution. Go to the directory where devenvis (for 2012 RC), and type devenv.exe /setup. It will fix your problem.
这是一个简单的解决方案。转到devenvis所在的目录(对于 2012 RC),然后键入devenv.exe /setup. 它会解决你的问题。
devenv.exeis usually in something like C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE.
devenv.exe通常是在类似的东西C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE。
Edit:It has been suggested that you do this from the Visual Studio command prompt (Start>Microsoft Visual Studio>Tools>Visual Studio Command Prompt), and/or make sure your command prompt has administrator permissions.
编辑:建议您从 Visual Studio 命令提示符(开始>Microsoft Visual Studio>工具>Visual Studio 命令提示符)执行此操作,和/或确保您的命令提示符具有管理员权限。
Note for others:This has a very good chance of working for many other versions of Visual Studio, including 2008, 2010, 11 beta, ...
其他人注意:这很有可能适用于许多其他版本的 Visual Studio,包括 2008、2010、11 测试版……
回答by mevans
I had the same issue....just uninstalling and re-installing alone did not correct the problem. After I un-installed, deleted all remnants of VS 2012 in program files, removed all related registry keys, and deleted the VS 2012 folder from My Documents, then re-installed, user types showed up in the display items in fonts and colors and everything went back to normal. My guess is that it was an issue with one or more of the registry keys but I can't be sure of that.
我遇到了同样的问题……只是卸载并重新安装并不能解决问题。卸载后,删除程序文件中所有残留的VS 2012,删除所有相关的注册表项,并从我的文档中删除VS 2012文件夹,然后重新安装,用户类型以字体和颜色出现在显示项中,一切恢复正常。我的猜测是一个或多个注册表项有问题,但我不能确定。
回答by Matt
If none of the above work for you, delete all GUID-named folders under this registry key (make sure your Visual Studio instance is closed):
如果以上方法都不适合您,请删除此注册表项下的所有以 GUID 命名的文件夹(确保您的 Visual Studio 实例已关闭):
If you're using Visual Studio 2012:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\FontAndColors
如果您使用的是 Visual Studio 2012:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\FontAndColors
If you're using Visual Studio 2013:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors
如果您使用的是 Visual Studio 2013:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\FontAndColors
If you're using Visual Studio 2015:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\FontAndColors
如果您使用的是 Visual Studio 2015:HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\FontAndColors
Restart Visual Studio, and you should see a few various "User Types" to configure. You can then import your Fonts and Colors that you backed-up, and everything will be good to go. This may also work for previous and future versions of VS, but I have not tested.
重新启动 Visual Studio,您应该会看到一些要配置的各种“用户类型”。然后,您可以导入备份的字体和颜色,一切都会好起来的。这可能也适用于以前和未来版本的 VS,但我还没有测试过。
Disclaimer:Make sure you export/backup your current Fonts and Colors settings before making these registry adjustments. I cannot be held responsible for you losing your configs :)
免责声明:在进行这些注册表调整之前,请确保导出/备份当前的字体和颜色设置。我对您丢失配置不承担任何责任:)
回答by Rashmin Javiya
exit devenv
退出开发环境
go to below path hkey_current_user\software\microsoft\visualstudio!
转到以下路径 hkey_current_user\software\microsoft\visualstudio!
remove 9.0 , 10.0 , 10.0_config (i mean to say all other folders except 11.0 and 11.0_config)
删除 9.0 、 10.0 、 10.0_config (我的意思是说除 11.0 和 11.0_config 之外的所有其他文件夹)
Now start devenv and see the magical colors get back normal
现在启动 devenv 并看到神奇的颜色恢复正常
回答by AssafDamari
If you still have this issue try ResetSettings (worked for me)
如果您仍然遇到此问题,请尝试重置设置(对我有用)
NOTE: this will reset the Visual Studio 2012 settings :)
注意:这将重置 Visual Studio 2012 设置:)
1) close vs.
1)关闭与
2)open cmd (as administrator).
2)打开cmd(以管理员身份)。
3) go to devnev.exe folder (something like "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" ).
3) 转到 devnev.exe 文件夹(类似于 "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE" )。
4) type "devnev.exe /ResetSettings"
4) 输入“devnev.exe /ResetSettings”
5) open vs and look at the beautiful colors
5)打开vs看看漂亮的颜色
回答by Leonardo Herrero
This is what worked for me:
这对我有用:
1 - delete all in C:\Users\userNAme\AppData\Roaming\Microsoft\VisualStudio.0
2 - open vs console as administrator, and run:
devenv.exe /setup
devenv.exe /ResetSettings
This will reset all your environment settings.
这将重置您的所有环境设置。
回答by Marc-André
My problem was limited to having the "DateTime" type not showing up in light blue like other class names. I fixed it by simply switching back-and-forth between VS Themes. Discovered by accident. Much quicker than reset settings or repair install...
我的问题仅限于“DateTime”类型不像其他类名那样以浅蓝色显示。我通过简单地在 VS 主题之间来回切换来修复它。偶然发现。比重置设置或修复安装快得多...
VS menu Tools -> Change Color Theme
VS 菜单工具 -> 更改颜色主题
回答by Peter Hedberg
For me "Productivity Power Tools 2012" was the cause. Nothing suggested here helped. After removing the Power Tools the colors came back.
对我来说,原因是“生产力电动工具 2012”。这里没有任何建议有帮助。卸下电动工具后,颜色又回来了。
回答by Nir Kornfeld
Found the source of the problem: If you have the "Productivity Power Tools 2012" installed,
找到问题根源:如果你安装了“ Productivity Power Tools 2012”,
you should go to Tools-> Options-> Productivity Power Toolsand turn off the "Colorized Parameter Help" option.
你应该去工具->选项->生产力电动工具并关闭“彩色参数帮助”选项。
This fixed the syntax highlight problem.
这修复了语法高亮问题。
回答by prlc
If anybody runs in to the same problem for Visual Studio 2013as I did, the only solution that worked for me was to first close VS2013 and then delete the following registry key:
如果有人和我一样在Visual Studio 2013 中遇到同样的问题,唯一对我有用的解决方案是先关闭 VS2013,然后删除以下注册表项:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio.0\FontAndColors
After reopening VS2013, my syntax highlighting for types was restored.
重新打开 VS2013 后,我的类型的语法突出显示恢复了。
Prior to deleting the registry key, I noticed that all of the "User Types..." settings in the Fonts and Colors section of Tools > Options were missing. Deleting the registry key restored them. They attained their default values which gave me the syntax highlighting colors I was looking for.
在删除注册表项之前,我注意到工具 > 选项的字体和颜色部分中的所有“用户类型...”设置都丢失了。删除注册表项可以恢复它们。他们获得了默认值,这为我提供了我正在寻找的语法突出显示颜色。
This was the only solution that worked for me. Switching themes, resetting my personalized settings to defaults, running devenv.exe with various command line switches to setup/reset Visual Studio did not work.
这是唯一对我有用的解决方案。切换主题、将我的个性化设置重置为默认值、使用各种命令行开关运行 devenv.exe 以设置/重置 Visual Studio 均无效。
I also created the following bug report with Microsoft on their Connect site:
我还在 Microsoft 的 Connect 站点上创建了以下错误报告:

