Search code examples
c#.netvstoroslynstrongname

How can I use my own key pair for signing Roslyn


I'm interested in compiling Roslyn myself to use his internal classes like RegexParser and others.

And I should also be able to sign the files, to use them inside a VSTO plugin.

I saw here a tutorial on how to sign Roslyn, but it's an old tutorial that no longer fits Roslyn today.

I downloaded and built the code from here But it was signed by:

C:\Users\google-dev\.nuget\packages\microsoft.dotnet.arcade.sdk\1.0.0-beta.21161.1\tools\snk\35MSSharedLib1024.snk

What's the right way to sign Roslyn with my own key? How can I set DelaySign = false?


Solution

  • To access Roslyn's internal classes you do not have to recompile Roslyn yourself. Instead use IgnoresAccessChecksToGenerator, it will give you access to all the internal classes you need, and you can also use it in VSTO.

    Generates IgnoresAccessChecksTo attributes and reference assemblies to allow compile-time access to internals

    From github

    Generates reference assemblies where all the internal types & members become public, and applies the IgnoresAccessChecksTo attribute