Closed greghroberts closed 1 year ago
Hi! Well, sorry about that, that's a bug - it didn't occur to me to test this particular case. Oops.
I'm happy you like the lib, though I wouldn't expect the embedded library mode to shrink the total application size by much once it's published - it only embeds RazorBlade.dll
as source code into your project, after changing its types' accessibility to internal
.
Note that in the meantime, you can work around this issue by adding the following to your template:
@functions
{
public YourModelType Model { get; init; }
}
That won't generate a constructor, but at least you'll have a Model
property.
Thanks for the quick response! For now, I'm just not going to use the option as you pointed out the size difference didn't seem noticeable.
This is fixed in v0.4.1 🙂
Hey, this package was exactly what I was looking for to add some simple templating capabilities to a CLI I'm working on for personal project.
I was trying out the RazorBladeEmbeddedLibrary mode described here to see if it would shrink my exe output and noticed it would only generate a default constructor even though the template uses
@inherits RazorBlade.HtmlTemplate<MyModel>;
. Unclear to me if this was intentional or not, but it was a bit confusing as I was testing things out. My code works fine if I remove that, but seems unexpected and not obvious where the issue is.Happy to help with exact reproduction if needed but was essentially (net7.0, MacOS):
ExcludeAssets="compile;runtime" PrivateAssets="all"
to the package referencemodel
parameterThanks!