Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Interpolate string c# 6.0 and Stylecop

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?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

SA0102 is an internal stylecop error so can't be supressed or ignored via a settings file.

You can suppress a file from stylecop by finding the filename and changing the section to this in the csproj:

<Compile Include="<filename>.cs">
  <ExcludeFromStyleCop>True</ExcludeFromStyleCop>
</Compile>

You can get the same effect by right clicking on the offending file and selecting "exclude from style cop" if you have the StyleCop plugin installed. It currently needs to be 4.7.50 alpha for Visual Studio 2015.


The more modern way of doing this is to make use of the Analyzers feature of Visual Studio 2015, with StyleCop.Analyzers.

enter image description here

Moving to Stylecop.Analyzers, this would add them into the rules in the relevant *.ruleset file (same place as CodeAnalysis rules)

enter image description here

and you can run them via

enter image description here

Which has the same effect as right click Run StyleCop:

I.e. giving:

enter image description here

This will have better support for C# 6, as StyleCop 4.7.50, which Supports Visual Studio 2015, is in alpha and does not yet support C# 6.

over 4 years ago · Santiago Trujillo Report

0

StyleCop should be able to handle C# 6 now:

Changes Beta 4.7.51: Added initial (and untested) support for C# 6.0 syntax

So with stable build 4.7.54 or later you should not encounter this anymore: http://stylecop.codeplex.com/releases/view/621306

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!