Statiq.Web icon indicating copy to clipboard operation
Statiq.Web copied to clipboard

Ship default tag helper package with Wyam.Razor

Open daveaglick opened this issue 6 years ago • 2 comments

The default tag helper package "Microsoft.AspNetCore.Mvc.TagHelpers" is needed for Razor to enable tag helper support. Without it, the Razor compiler will attempt to locate the tag helper assembly and will be unable to, leading to errors. Consider shipping it with the Razor module. Version 1.1.7 appears to be compatible with the current version of Razor used in Wyam (but will need a little testing).

In the meantime, adding the following to a config.wyam file appears to work:

#n Microsoft.AspNetCore.Mvc.TagHelpers -v [1.1.7]

daveaglick avatar Apr 11 '18 13:04 daveaglick

For anyone wanting to use TagHelpers on their wyam site, I had to:

Add this to config.wyam:

#n Microsoft.AspNetCore.Mvc.TagHelpers -v [2.1.1]

Create a _ViewImports.cshtml file, containing:

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

Then, I had to delete the config.wyam.packages.xml file, and the dll, to force re-creating it (I believe this was required, not 100% sure).

johncrim avatar Feb 23 '20 18:02 johncrim

Nice! Thanks for the follow-up. Reminds me I probably need to revisit this for Statiq too and hopefully ship it in the box.

daveaglick avatar Feb 23 '20 18:02 daveaglick