Skip to content

Instantly share code, notes, and snippets.

@jmarolf
Last active August 29, 2015 14:21
Show Gist options
  • Save jmarolf/b017f7032ea0369d4037 to your computer and use it in GitHub Desktop.
Save jmarolf/b017f7032ea0369d4037 to your computer and use it in GitHub Desktop.
Change default severity
var compilation = project.GetCompilationAsync().Result;
var specificDiagnosticOptions = new[] { new KeyValuePair<string, ReportDiagnostic>(NotReportedByDefaultAnalyzer.DiagnosticId, ReportDiagnostic.Warn) };
var options = new CSharpCompilationOptions(outputKind: OutputKind.DynamicallyLinkedLibrary, specificDiagnosticOptions: specificDiagnosticOptions);
var compilationWithOptions = compilation.WithOptions(options);
var compilationWithAnalyzers = compilationWithOptions.WithAnalyzers(ImmutableArray.Create(analyzer));
var diags = compilationWithAnalyzers.GetAnalyzerDiagnosticsAsync().Result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment