@addTagHelper could not load file or assembly

人盡茶涼 提交于 2019-12-10 10:44:04

问题


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.


回答1:


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).




回答2:


Drop the quotation marks in the @addTagHelper directive.



来源:https://stackoverflow.com/questions/39413432/addtaghelper-could-not-load-file-or-assembly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!