I'm using default Roslyn SDK templates that came with Visual Studio 2017. The projects they create target .NET Framework Portable. I'm assuming Roslyn extensibility projects can target .NET Standard \ Core instead of Portable and I'm looking for templates or a sample of Roslyn Analyzer \ Refactoring project that I could study.
Sample of converted analyzer from default analyzer template is available here. There is original analyzer for comparison along with TestAnalyzerStandard
which targets .NET standard.
Steps to make it work:
Microsoft.Composition
latest version. This is needed by Microsoft.CodeAnalysis.CSharp.Workspaces
. If you try to add workspaces first, you will get error that referenced composition package is not compatible.Microsoft.CodeAnalysis.CSharp
(I'm using latest 1.* version)Microsoft.CodeAnalysis.Csharp.Workspaces
(version should match the version of Microsoft.CodeAnalysis.CSharp
).source.extension.vsixmanifest
, go to assets tab and change reference to .NET standard librarynuget pack Diagnostic.nuspec .
. Diagnostic.nuspec
is valid for Nuget 2.x. If you are using nuget via package management console in VS 2017 you will have to change <file src="*.dll" ..."
to <file src="bin\*\netstandard1.3\*.dll" ...
.Those steps are result of my experimentation with analyzers (I previously played with creating DLL which targeted full framework instead of being portable library). They are not by any means official.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With