diff --git a/src/SponsorLink/readme.md b/src/SponsorLink/readme.md index 765bd9d..cb651a1 100644 --- a/src/SponsorLink/readme.md +++ b/src/SponsorLink/readme.md @@ -1,25 +1,34 @@ -# .NET Sample +# SponsorLink .NET Analyzer -This sample contains an absolute minimal package that can be built and published to NuGet.org, -which contains just an analyzer assembly that consumes the SponsorLink package for nuget authors. +This is one opinionated implementation of [SponsorLink](https://devlooped.com/SponsorLink) +for .NET projects leveraging Roslyn analyzers. -It can be installed to a project by running the following dotnet command from the target -project directory: +It is intended for use by [devlooped](https://github.com/devlooped) projects, but can be +used as a template for other sponsorables as well. Supporting arbitrary sponsoring scenarios +is out of scope though, since we just use GitHub sponsors for now. -``` -dotnet add package SponsorableLib --version 42.42.42-main.* -s https://pkg.kzu.io/index.json -``` +## Usage + +A project initializing from this template repo via [dotnet-file](https://github.com/devlooped/dotnet-file) +will have all the sources cloned under `src\SponsorLink`. -This will run the SponsorLink check with `https://github.com/sponsors/devlooped` for your -locally configured git email on IDE/Editor full builds. +Including the analyzer and targets in a project involves two steps. -The sample contains two analyzers, one with simple SponsorLink settings and an advanced one, -so you will get both running the sample check. +1. Create an analyzer project and add the following property: -The Analyzer folder contains the analyzer project, and the Tests project is set up to consume -it and allow for easy debugging by just running the Analyzer as the startup project from -Visual Studio (for example). +```xml + + ... + $(MSBuildThisFileDirectory)..\SponsorLink\SponsorLink.targets + +``` + +2. Add a `buildTransitive\[PackageId].targets` file with the following import: -> NOTE: after initial restore, it might be necessary to restart the IDE for the analyzer -> assemblies to be properly resolved and loaded for debugging. +```xml + + + +``` +As long as NuGetizer is used, the right packaging will be done automatically. \ No newline at end of file