Create NuGet with Metalama
With source generators I have to add some MSBuild configuration, but with Metalama it seems I don't need it.
My goal is to create a fabric that detects classes inheriting from
BusinessException
, and then apply an attribute/aspect to it, generating code.
Then I'll publish a NuGet to nuget.org, and when I create it (dotnet build & pack), I'll pass the license key with an envinroment variable to MSBuild.
And... just that? Will library users have to specify a license key? Do I have to publish the NuGet as an analyzer? Anything? Will they have Metalama code generation out-of-the-box inheriting from BusinessException
?
Thanks!8 Replies
Yeah, there are no other technical hurdles when publishing a package that exposes Metalama aspects or transitive project fabrics.
Regarding licensing, your users will need a license, though the free license my be sufficient, depending on the number of aspects they use.
Also, if you apply for the free redistribution license (see https://www.postsharp.net/metalama/pricing), then your whole library will count the same as a single aspect, so the free license will definitely be sufficient for your users.
It's incredible the work you're doing with this framework. Thanks!
It's a non-commercial open source library that will be used by companies. But then I have doubts reading the pricing model.
When they add my nuget package, will they have to activate anything or not? "manual step"
Yes, they will eventually have to activate Metalama.
When they first install your package from NuGet, their trial period will start automatically, no activation is necessary at this point.
But after 45 days, they will need to activate a free license.
That requires installing the metalama command line tool (
dotnet tool install -g metalama.tool
) and then activating the license (metalama license free
).It seems annoying. Is there another option? Like a <PackageReference License="aaa"> in the csproj?
Not at the moment.
But we can reconsider. It's just a description of how it works now.
GitHub
Reconsider the need for users of a redistribution license to regist...
The requirement to manually enable Metalama Free when using Metalama through a NuGet package is considered useless friction.
You can like it 🙂