Visual Studio 2010에서 Visual Studio 2010으로 사용자 지정 FxCop (= 코드 분석) 규칙을 마이그레이션하려고합니다.FxCop 사용자 지정 규칙에 VS2012에 이름이 없습니다 (공식 규칙에는 이름이 있습니다)
:지금까지, 그들은 한 가지를 제외하고 잘 작동 : 이름이 마이크로 소프트의 규칙에 대해 표시되는 동안 (>Code Analysis
- ->Other windows
View
) 만 CheckId
과 Resolution
이 표시 이름은 결과 창에서 비어 있습니다
stran이란 무엇입니까?
내 규칙에 어떤 문제가 : GE는 이름 이 규칙 집합 편집기에서 볼 수 점이다?
세부
다음모두 규칙은 MSBuild의 출력에 표시하는 방법이다는 (비린내 뭔가있다,하지만 난 다른 메시지를 왜 이해가 안 돼요) :
여기6>c:\Users\Me\MySolution\MyProject\Program.cs(15): warning : CA1804 : Microsoft.Performance : 'Foo<T>.SomeMethod()' declares a variable, 'z', of type 'int', which is never used or is only assigned to. Use this variable or remove it.
6>MSBUILD : warning : CF1001 : CustomRules.ThreadSafety : The public Public Field "Tests.Program.Foo" must be preceded of readonly
가있다
<?xml version="1.0" encoding="utf-8" ?>
<Rules FriendlyName="CustomRules">
<Rule TypeName="PublicFieldsMustBeReadonly" Category="CustomRules.ThreadSafety" CheckId="CF1001">
<Name>Public Fields must be readonly or must be replaced with a Getter/Setter Method.</Name>
<Description>Public Fields must be readonly or must be replaced with a Getter/Setter Method.</Description>
<GroupOwner>MyCompany</GroupOwner>
<DevOwner>Me</DevOwner>
<Owner>Me</Owner>
<Url>http://example.com</Url>
<Resolution>The public Public Field "{0}" must be preceded of readonly</Resolution>
<Email>[email protected]</Email>
<MessageLevel Certainty="100">Warning</MessageLevel>
<FixCategories>Breaking</FixCategories>
</Rule>
</Rules>
을 그리고 여기에 마이크로 소프트의 규칙에 대한 XML의 규칙 선언입니다 : 내 규칙에 대한 XML 파일에 선언을 지배.
<Rules FriendlyName="Performance Rules">
<Rule TypeName="RemoveUnusedLocals" Category="Microsoft.Performance" CheckId="CA1804">
<Name>
Remove unused locals
</Name>
<Description>
Remove locals that are not used or are only assigned to in method implementations.
</Description>
<Url>
@ms182278(VS.100).aspx
</Url>
<Resolution>
{0} declares a variable, {1}, of type {2}, which is never used or is only assigned to. Use this variable or remove it.
</Resolution>
<Email />
<MessageLevel Certainty="95">
Warning
</MessageLevel>
<FixCategories>
NonBreaking
</FixCategories>
<Owner />
</Rule>
</Rules>
를 내 경우, 내 DLL의 경로를 제공하기 위해'.ruleset' 파일의'RuleHintPaths' 태그를 사용하지만, 당신이 말한대로 VS의 플러그인을 무시하는 것 같다. 대답을 주셔서 감사합니다. 비록 제가보고 싶지 않더라도. :) –
파일을 \ Team Tools \ Static Analysis Tools \ FxCop \ Rules'에 복사하지만 우리가 자주 규칙을 추가하거나 수정하기 때문에 차선입니다. 내 시스템에 레지스트리 키가 없어서 만들려고했으나 제대로 작동하지 않는 것 같습니다. Windows 7 64 비트 시스템이 있는데 키가 다른 곳에있을 수 있습니까? 감사! –
레지스트리 키를 추가 한 후 Visual Studio를 다시 시작 했습니까? 또한 기존의'HKEY_CURRENT_USER \ Software \ Microsoft \ VisualStudio \ 11.0 \ CodeAnalysis' 키 아래에 FxCopRulePath 값을 추가하려고 했습니까? 아니면 단어 사이에 공백을 넣은 새로운'Code Analysis' 키를 만들었습니까? (후자가 필요합니다.) –