visual studio 2015 - Interpolate string c# 6.0 and Stylecop -


i using stylecop version : 4.7.49.0

has used latest interpolate string functionality in c# 6.0

example

var totalunits = getunitsgettotalissuedshares(myid); var teststring = $"test units :{totalunits}, have been shipped."; 

when build stylecop error sa0102 - because stylecop cant parse file. doesn't seem there new version of stylecop can handle 6.0 yet?

error :sa0102: syntax error has been discovered in file

is there anyway around error?

sa0102 internal stylecop error can't supressed or ignored via settings file.

you can suppress file stylecop finding filename , changing section in csproj:

<compile include="<filename>.cs">   <excludefromstylecop>true</excludefromstylecop> </compile> 

you can same effect right clicking on offending file , selecting "exclude style cop" if have stylecop plugin installed. needs 4.7.50 alpha visual studio 2015.


the more modern way of doing make use of analyzers feature of visual studio 2015, stylecop.analyzers.

enter image description here

moving stylecop.analyzers, add them rules in relevant *.ruleset file (same place codeanalysis rules)

enter image description here

and can run them via

enter image description here

which has same effect right click run stylecop:

i.e. giving:

enter image description here

this have better support c# 6, stylecop 4.7.50, supports visual studio 2015, in alpha , not yet support c# 6.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -