Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 2.8 KB

2020-09-12.md

File metadata and controls

31 lines (22 loc) · 2.8 KB

Date: September 12 2020
Original Post: https://www.reddit.com/r/dotnet/comments/irancy/standard_targetframework_documentation_dynamic/

.NET Target Framework Badge

You can use shields.io io to create dynamic badges to document what the TargetFramework is of your .NET project. shields.io supports dynamic query badges in XML format, and your .csproj, .fsproj, or .vbproj files are XML files. Here is an example badge from my Towel project:

.NET target

<a href="https://dotnet.microsoft.com/download" alt=".NET target"><img alt=".NET target" src="https://img.shields.io/badge/dynamic/xml?color=%23512bd4&label=target&query=%2F%2FTargetFramework%5B1%5D&url=https%3A%2F%2Fraw.githubusercontent.com%2FZacharyPatten%2FTowel%2Fmain%2FSources%2FTowel%2FTowel.csproj&logo=.net" title="Go To .NET Download"></a>

How can you make your own badge? Go to shields.io and scroll down to the "dynamic" section, and input the parameters for your project:

Then just click Make Badge and shields.io will redirect you to your badge. Just copy the URL that you are redirected to, and use it inside an image markdown or HTML like so:

<a href="https://dotnet.microsoft.com/download" alt=".NET target"><img alt=".NET target" src="YOUR-BADGE-URL" title="Go To .NET Download"></a>

Where "YOUR-BADGE-URL" is the URL of your badge.

If you want to add the .NET logo to the badge, you can append this on the end of the URL of your badge: &logo=.net.

Since this is a dynamic queried badge, if you change the target framework on your project, this badge will automatically update with it.

It would be nice if everyone in the .NET community started using standard target framework badges at the top of their README files. :)