Spinnernicholas / EnumFastToStringDotNet

This is a Visual Studio C# source generator for automatically generating enum extension methods that implement a switch expression based ToString method. Why? The default enum ToString method implements a binary search which is great for large lists but becomes time and memory inefficient for a just a few items when compared to a switch expression.
31 stars 2 forks source link

Create Nuget Package #1

Open Spinnernicholas opened 3 years ago

Spinnernicholas commented 3 years ago

I want to publish a Nuget package to make using this generator as easy as possible. The only problem is no one seems to agree on how to configure the project so that the generator gets loaded correctly. I have tried several methods including using the analyzer template and trying a handful of templates/tutorials from GitHub. Nothing has worked for me.

Also, I want the Nuget package to be a different project from the main project.

alex-jitbit commented 1 year ago

It's actually not that hard. Here's how we did it in https://github.com/jitbit/MapDataReader/

Check out this file, near the end, how it makes sure it's a source generator package: https://github.com/jitbit/MapDataReader/blob/main/MapDataReader/MapDataReader.csproj

Also, you need to target net standard 2.0 I believe

Spinnernicholas commented 1 year ago

@alex-jitbit Thanks! That's what I was having trouble figuring out.