Conan Build status

Conan is a lightweight fork of the .NET Compiler Platform ("Roslyn") by adding a compiler plugin infrastructure. These plugins can be deployed and installed as regular Diagnostic Analyzers.


This repository is under construction, a documentation will follow in the coming weeks


How to develop a Conan compiler plugin?

  1. Create a netstandard1.3 library

  2. Add the latest Conan.CodeAnalysis package (alpha5+)

  3. Create a new class an inherit from CompilationRewriter. See HelloWorld plugin example

        public class MyCompilationRewriter : CompilationRewriter
            public override Compilation Rewrite(CompilationRewriterContext context)
                var compilation = context.Compilation;
                // Transform compilation
                return compilation;
  4. If you want to create a NuGet package for this plugin, you can add a reference to the NuGet package AnalyzerPack and it will transform automatically your package into a Diagnostic Analyzer NuGet package (when doing a dotnet/msbuild Pack)

How to use this plugin in your project?

  1. Add the package Conan.Net.Compilers to your project: This will make the Conan compiler as the default CSharp/VB compiler and replace the default Roslyn compiler (This package works for both Full framework and Core framework unlike the Roslyn packages)
  2. Add your plugin you developed either by:
    • Adding directly a reference to it into your csproj. This is what is used by the HelloWorld package:
            <Analyzer Include="..\Conan.Plugin.HelloWorld\bin\$(Configuration)\netstandard1.3\Conan.Plugin.HelloWorld.dll" />
    • Adding a reference to the NuGet package of your plugin (that has been through AnalyzerPack)
  3. If you compile your project, the plugin will be automatically loaded and executed, check the logs!

NuGet Packages

Their are 2 fundamental root packages in Conan:

  • Conan.Net.Compilers: This is the Conan compiler that is replacing the default Roslyn compiler, working with both .NET full framework and .NET Core projects. This compiler will be responsible to load your Conan plugins (as Diagnostic Analyzers)
  • Conan.CodeAnalysis: This is the root package for developing a Conan compiler plugin that you should reference from your plugin compiler library
Roslyn Conan NuGet
Conan.Net.Compilers NuGet
Microsoft.CodeAnalysis Conan.CodeAnalysis NuGet
ā€¢ Microsoft.CodeAnalysis.Common ā€¢ Conan.CodeAnalysis.Common NuGet
ā€¢ Microsoft.CodeAnalysis.CSharp ā€¢ Conan.CodeAnalysis.CSharp NuGet
ā€¢ Microsoft.CodeAnalysis.CSharp.Workspaces ā€¢ Conan.CodeAnalysis.CSharp.Workspaces NuGet
ā€¢ Microsoft.CodeAnalysis.VisualBasic ā€¢ Conan.CodeAnalysis.VisualBasic NuGet
ā€¢ Microsoft.CodeAnalysis.VisualBasic.Workspaces ā€¢ Conan.CodeAnalysis.VisualBasic.Workspaces NuGet
ā€¢ Microsoft.CodeAnalysis.Workspaces.Common ā€¢ Conan.CodeAnalysis.Workspaces.Common NuGet


All the people involved behind the .NET Compiler Platform ("Roslyn"). Conan is a very little addition to the huge work already done there.

The logo is called Lion created by Jennifer Keana from the Noun Project


Same license than Roslyn: Apache-2.0


Alexandre MUTEL aka xoofx


Lightweight fork of the .NET Compiler Platform ("Roslyn") by adding a compiler plugin infrastructure

Conan Info

ā­ Stars 96
šŸ”— Source Code
šŸ•’ Last Update 2 years ago
šŸ•’ Created 4 years ago
šŸž Open Issues 2
āž— Star-Issue Ratio 48
šŸ˜Ž Author conan-roslyn