[英]Using Directives Sorted in Wrong Order
I'm using the Power Commands extension with Visual Studio 2012. I have the option checked to remove and sort usings on save. 我在Visual Studio 2012中使用了Power Commands扩展。我选中了选项以在保存时删除和排序使用。 The problem is that the System.Xxx directives are being sorted last, and that's causing a style analysis error:
问题是System.Xxx指令最后排序,这导致样式分析错误:
SA1208: System using directives must be placed before all other using directives.
SA1208:系统使用指令必须放在所有其他using指令之前。
Before save: 保存之前:
using System;
using System.Diagnostics.CodeAnalysis;
using Foo;
After save: 保存后:
using Foo;
using System;
using System.Diagnostics.CodeAnalysis;
This worked correctly (System.Xxx first) with VS 2010. Anyone know how to correct this? 这与VS 2010正常工作(System.Xxx第一)。任何人都知道如何纠正这个问题?
Note: Even if it didn't cause an SA error, I'd still prefer the system directives to be first. 注意:即使它没有导致SA错误,我仍然更喜欢系统指令是第一个。
Goto the "Quick Launch" (Ctrl+Q) and type "using" and press Enter
. 转到“快速启动”(Ctrl + Q)并键入“using”,然后按
Enter
。
Then change the following setting: 然后更改以下设置:
It's an annoying default setting, I have no idea why Microsoft chose that, it goes against all previous standards that I've ever seen. 这是一个恼人的默认设置,我不知道为什么微软选择它,它违背了我见过的所有先前的标准。
EDIT: Thanks to Oskar we have a reason : 编辑:感谢Oskar我们有一个理由 :
The reason for the change in default behavior is due to the fact that Windows App Store applications prefer to have 'Windows.
更改默认行为的原因是Windows App Store应用程序更喜欢使用“Windows”。 ' at the top of the file rather than 'System.
'在文件的顶部而不是'系统。 '
“
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.