Skip to content

Converts all JetBrains ReSharper code annotation attributes to External Annotations, so you can provide R# annotations to 3rd parties but don't need to deploy JetBrainsAnnotations.dll.

License

Notifications You must be signed in to change notification settings

tom-englert/JetBrainsAnnotations.Fody

Repository files navigation

Chat on Gitter NuGet Status Build status

This is an add-in for Fody

Icon

Converts all JetBrains ReSharper code annotation attributes to External Annotations, so you can provide R# annotations to 3rd parties but don't need to deploy JetBrainsAnnotations.dll.

Installation

  1. Install the JetBrainsAnnotations.Fody NuGet package and update the Fody NuGet package:
PM> Install-Package JetBrainsAnnotations.Fody
PM> Update-Package Fody

The Update-Package Fody is required since NuGet always defaults to the oldest, and most buggy, version of any dependency.

  1. Add JetBrainsAnnotations to your FodyWeavers.xml:
<Weavers>
  <JetBrainsAnnotations />
</Weavers>

What are JetBrains Annotations

The assembly JetBrains.Annotations.dll is shipped as a nuget package. It provides standard JetBrains ReSharper code annotation attribute implementations. This allows you to better leverage the ReSharper intellisense.

To provide the annotations to 3rd parties you must define JETBRAINS_ANNOTATIONS to include the attributes in your assembly. However now you have a reference and would need to ship the JetBrainsAnnotations.dll with your product.

This Fody plugin adds the define JETBRAINS_ANNOTATIONS to your existing defines, then converts all attributes to an external annotations XML file on the fly, and then removes the reference to JetBrains.Annotations again so you can ship just the text file with your assembly and don't need to deploy JetBrains.Annotations.dll.

For more information about JetBrains Annotations read:

What it actually does to your assembly

  • For each attribute defined in JetBrainsAnnotations.dll it adds an entry to your assemblies external annotations XML file and removes the usage of the attribute from your assembly.
  • Removes the reference to JetBrainsAnnotations.dll

What it actually does to your project

  • Updates <project name>.ExternalAnnotations.xml every time you compile.

    NOTE: To make your annotations available to 3rd parties, you must ship this file along with the assembly.

  • If your project is set to generate an XML documentation file, the documentation is extended with the annotation attributes.

What you may need to change manually

  • Add the <project name>.ExternalAnnotations.xml to your project manually and mark it as content + copy to output.
  • Mark the reference to Jetbrains.Annotations.dll as Copy Local => False, so it won't get copied to your target directory and eventually get picked up by installers.
  • If you deploy your project as a NuGet package, add developmentDependency="true" to the JetBrains.Annotations package entry in your projects packages.config files, else NuGet will list JetBrains.Annotations as a dependency of your package:
    <package id="JetBrains.Annotations" version="11.0.0" targetFramework="net452" developmentDependency="true" />
    or if you are using a PackageReference in your project files, mark it as private assests:
    <PackageReference Include="JetBrains.Annotations" Version="*">
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>

Icon

Fighter Jet designed by Luke Anthony Firth from The Noun Project.

About

Converts all JetBrains ReSharper code annotation attributes to External Annotations, so you can provide R# annotations to 3rd parties but don't need to deploy JetBrainsAnnotations.dll.

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages