I have an ASP.NET core project generated with Yeoman generator-aspnet.
My problem is that I can't use the generator provided tag helper (and my test tag help doesn't work either).
The project name is react_tests
, and this is the _ViewImports.cshtml
file
@using react_tests
@using react_tests.Models
@using react_tests.Models.AccountViewModels
@using react_tests.Models.ManageViewModels
@using Microsoft.AspNetCore.Identity
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, react_tests
I tried replacing the last line with:
@addTagHelper "*, react_tests"
and
@addTagHelper "*, TagHelpers"//the folder for tag helpers
and
@addTagHelper "react_tests.TagHelpers.MenuLinkTagHelper, react_tests"
But I always receive the following error:
Cannot resolve TagHelper containing assembly 'react_tests'. Error: Could not load file or assembly 'react_tests, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
For others gettings this error, it occurs if the name given is not an assembly name. In my case, I put in a namespace by mistake.
It has nothing to do with quotes either (official response: https://github.com/aspnet/Razor/issues/1200).
Drop the quotation marks in the @addTagHelper directive.
来源:https://stackoverflow.com/questions/39413432/addtaghelper-could-not-load-file-or-assembly