3

We recently switched to Visual Studio 2015 and now want to make use of the new Roslyn-Analyzer feature. In fact we want to replace the "legacy" StyleCop with the newer StyleCop Analyzers (https://github.com/DotNetAnalyzers/StyleCopAnalyzers). In VS2013 we had a custom Check-In policy which ran StyleCop and prevented a Check-In if there were any violations. Can something similar be achieved with the Roslyn-Analyzers as well? Is it supported "out of the box" or do we have to write a custom check-in policy as well?

huserben
  • 1,034
  • 1
  • 10
  • 19

2 Answers2

1

You have to create a custom check-in policy to achieve it.

Eddie Chen - MSFT
  • 29,708
  • 2
  • 46
  • 60
  • Hi Eddie, do you know how such a policy can be written? I mean how I can trigger the code analysis for the changed files in my policy? I did not found any information about that online – huserben Nov 04 '15 at 09:47
  • 1
    You can refer to following blog for details: Create and deploy custom check-in policy: http://blogs.msdn.com/b/jimlamb/archive/2010/03/31/how-to-implement-package-and-deploy-custom-check-in-policy-for-tfs-2010.aspx. Code analysis with Roslyn: http://www.codeproject.com/Articles/861548/Roslyn-Code-Analysis-in-Easy-Samples-Part; http://www.codeproject.com/Articles/871704/Roslyn-Code-Analysis-in-Easy-Samples-Part – Eddie Chen - MSFT Nov 05 '15 at 01:57
0

I tried lately again to tackle this issue and realized that Microsoft apparently changed their previous Code Analysis Check-In policy to work with the new Roslyn Analyzer warnings (tried via my Visual Studio Team Services TFS). It checks only files that are in the "Include" section and forces you to have an actual build of the files you want to check in and blocks check-in's if you have any warning.

huserben
  • 1,034
  • 1
  • 10
  • 19