How to Use Roslynator .NET API
Roslynator extends the Roslyn API and is useful when building custom analyzers and refactorings.
Packages
Analyzer Package Configuration
Analyzer NuGet packages cannot reference other packages, so you need to bundle the Roslynator DLLs directly:
<file src="bin\$Configuration$\netstandard2.0\Roslynator*.dll" target="analyzers\dotnet\cs" />
Foo.Analyzers.nuspec
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>Foo.Analyzers</id>
<version>1.0.0</version>
<authors>Me</authors>
<projectUrl>https://github.com/me/foo-analyzers</projectUrl>
<repository type="git" url="https://github.com/me/foo-analyzers.git" />
<developmentDependency>true</developmentDependency>
</metadata>
<files>
<file src="bin\$Configuration$\netstandard2.0\Foo.Analyzers.dll" target="analyzers\dotnet\cs" />
<file src="bin\$Configuration$\netstandard2.0\Roslynator*.dll" target="analyzers\dotnet\cs" />
<file src="tools\*.ps1" target="tools\" />
</files>
</package>
Package Folder Structure
Foo.Analyzers.1.0.0.nupkganalyzersdotnetcsFoo.Analyzers.dllRoslynator.Core.dllRoslynator.CSharp.dllRoslynator.CSharp.Workspaces.dllRoslynator.Workspace.Core.dll