NiceIO icon indicating copy to clipboard operation
NiceIO copied to clipboard

NiceIO as a source-only package :D

Open scottbilas opened this issue 1 year ago • 0 comments

NiceIO as a source-only package gives two great tastes that taste great together:

  1. It's a package! Add to any project with nuget commands/ui, do easy version upgrades.
  2. It's still source! There's no DLL, it's directly compiled into whatever project references it.

A user would do this:

  • dotnet add package NiceIO or do the search+add thing in the UI.
  • Decide whether or not to republish by setting NICEIO_PUBLIC (same behavior as now).
  • Set the namespace to put NPath in by adding to the .csproj in an ItemGroup: <PreprocessorValue Include="NICEIO_NAMESPACE" Value="YourNamespaceHere" Visible="false" />
  • Make a new partial class NPath file and add statics or whatever, if they want.

Some implementation notes:

  • I don't love the required PreprocessorValue thing. There's probably some nuget package magic that can add a PreprocessorValue automatically..I have seen nuget packages modify the csproj they become a part of, but didn't look into it.
  • Another option for the .cs.pp is $rootnamespace$, which requires no configuration, but is more limited in that it depends on the csproj root namespace setting. Nuget's substitution stuff is really limited. Tradeoffs..
  • README should probably say something about the package and give the "use" instructions above. I can do an update there too in this PR if you want.
  • I have very little experience with nuget packages so the .nuspec is probably needing some attention.

What do you think?

scottbilas avatar Nov 15 '23 22:11 scottbilas