This is an add-in for Fody
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.
- 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.
- Add
JetBrainsAnnotations
to your FodyWeavers.xml:
<Weavers>
<JetBrainsAnnotations />
</Weavers>
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:
- http://www.jetbrains.com/resharper/webhelp/Code_Analysis__External_Annotations.html
- http://www.jetbrains.com/resharper/features/code_analysis.html#Annotated_Framework
- 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
-
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.
- 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
asCopy 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 projectspackages.config
files, else NuGet will list JetBrains.Annotations as a dependency of your package:or if you are using a<package id="JetBrains.Annotations" version="11.0.0" targetFramework="net452" developmentDependency="true" />
PackageReference
in your project files, mark it as private assests:<PackageReference Include="JetBrains.Annotations" Version="*"> <PrivateAssets>all</PrivateAssets> </PackageReference>
Fighter Jet designed by Luke Anthony Firth from The Noun Project.