stylecop

Exclude file from StyleCop analysis: “auto-generated” tag is ignored

半世苍凉 提交于 2019-12-04 15:28:06
问题 At the beginning of a C# file, I have added: //----------------------------------------------------------------------- // <copyright company="SomeCompany" file="MyFile.cs"> // Copyright © Some Company, 2011 // </copyright> // <auto-generated /> //----------------------------------------------------------------------- I want StyleCop to skip checking this file, so I used the auto-generated trick explained in other answers. However, after cleaning and rebuilding my solution, StyleCop keeps

How to combine multiple custom StyleCop rules under a single “Custom Rules” node in StyleCop settings and concurrency

霸气de小男生 提交于 2019-12-04 10:03:29
Based on several good articles I have been able to successfully create a few custom StyleCop rules. For reference, a few articles I found very useful on this topic are listed here: How to Implement a Custom StyleCop Rule Creating Custom Rules for Microsoft Source Analyzer - Part I Creating Custom Rules for Microsoft Source Analyzer - Part II Creating Custom Rules for Microsoft Source Analyzer - Part III I am using Visual Studio 2010 Ultimate edition along with StyleCop version 4.4.0.14. Creating a custom StyleCop rule calls for creating a class file along with a corresponding XML file, which

How do I integrate StyleCop 4.7 with Visual Studio 2013?

好久不见. 提交于 2019-12-04 07:54:46
问题 I really want to use StyleCop with my Visual Studio 2013, but unfortunately it won't work. I've installed the 4.7 version from the official site, checking all options, both VS Studio integration and MSBuild integration, following the precise instructions (download, install while VS applications are closed, then start VS) but it just won't show up in my Visual Studio 2013. The StyleCop website says that it should be compatible with VS2013. It won't show up anything related to StyleCop under

Enforce custom stylecop rules for a checkin policy on TFS

荒凉一梦 提交于 2019-12-03 21:38:18
问题 I have installed StyleCop CheckIn policy (from here) and it works great. However I have written some custom rules which I want to be enforced as part of the CheckIn policy (Visual Studio 2008, Team Explorer 2008, TFS 2005). The custom rules appear fine in the settings file when I right click on a project and click "StyleCop Settings". However when I add my CheckIn policy, and try to import the same settings.StyleCop file my Custom Rules don't appear in the editor window. Another problem,

TemporaryGeneratedFile_[guid] in /obj/debug breaking build

て烟熏妆下的殇ゞ 提交于 2019-12-03 18:38:06
问题 I have 3 temporary files being created in obj/debug: E.g. TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs (The guids don't seem to change even after a solution clean) My build is failing because: SA1633: The file has no header, the header Xml is invalid, or the header is not located at the top of the file. I don't want to turn the StyleCop rule off. How

Implementing StyleCop MSBUILD From NuGet Package

痴心易碎 提交于 2019-12-03 17:39:20
问题 A quick precursor to say that I've done the usual searching around the forums and net in general, and I've tried a multitude of suggestions found on this forum and elsewhere to no avail. The problem I'm having is that my company is looking to implement internal automated peer-reviews (to an extent of course) with the use of tools such as StyleCop, ReSharper and JSLint (etc etc). We're using a custom NuGet package against our internal NuGet Package Repository (feed) so that our developers get

Interpolate string c# 6.0 and Stylecop

末鹿安然 提交于 2019-12-03 15:01:33
问题 I am using Stylecop version : 4.7.49.0 Has anyone used the latest interpolate string functionality in c# 6.0 example var totalUnits = GetUnitsGetTotalIssuedShares(myId); var testString = $"Test Units :{totalUnits}, have been shipped."; When I build i get the stylecop error SA0102 - because stylecop cant parse the file. It doesn't seem like there is a new version of stylecop that can handle 6.0 yet? error :SA0102: A syntax error has been discovered in file Is there anyway around this error?

Disable StyleCop for specific lines

柔情痞子 提交于 2019-12-03 10:30:36
问题 We're using StyleCop in our C# projects. In some cases we'd like to avoid the rules though. I know you can add // <auto-generated /> in the beginning of the file to make StyleCop ignore it. However, I don't want to ignore the rules for the whole file - only a block of code within it. Can I disable StyleCop for specific lines somehow? 回答1: You can suppress rules by adding attributes to blocks of code. Here's a simple example on a class from the blog post linked below, but you can do it on

Exclude file from StyleCop analysis: “auto-generated” tag is ignored

≯℡__Kan透↙ 提交于 2019-12-03 09:37:43
At the beginning of a C# file, I have added: //----------------------------------------------------------------------- // <copyright company="SomeCompany" file="MyFile.cs"> // Copyright © Some Company, 2011 // </copyright> // <auto-generated /> //----------------------------------------------------------------------- I want StyleCop to skip checking this file, so I used the auto-generated trick explained in other answers . However, after cleaning and rebuilding my solution, StyleCop keeps generating warnings for this file. Why does this happen? How can it be fixed? I am using Microsoft Visual

Where is the Stylecop configuration file?

こ雲淡風輕ζ 提交于 2019-12-03 09:36:16
I've installed Stylecop via NuGet. I wish to disable some rules, and I know this can be done via a configuration file from what I've read. However, I can't find the file anywhere, and there seems to be little documentation describing where to create the file. How do I go about making the file? Edit : As this question still seems to be getting attention a couple of years later, I recommend using Roslyn Analyzer based StyleCop now. This has a few advantages: It's actually maintained and active. Takes advantage of Roslyn, and can perform some changes for you. It's a NuGet package so is installed