@addTagHelper无法加载文件或程序集 [英] @addTagHelper could not load file or assembly

查看:231
本文介绍了@addTagHelper无法加载文件或程序集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Yeoman generator-aspnet生成的ASP.NET核心项目. 我的问题是我无法使用生成器提供的标签帮助程序(并且我的测试标签帮助也不起作用). 项目名称是react_tests,这是_ViewImports.cshtml文件

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"

@addTagHelper "*, TagHelpers"//the folder for tag helpers

@addTagHelper "react_tests.TagHelpers.MenuLinkTagHelper, react_tests"

但是我总是收到以下错误:

But I always receive the following error:

无法解析包含程序集"react_tests"的TagHelper.错误:无法加载文件或程序集"react_tests,Culture = neutral,PublicKeyToken = null".系统找不到指定的文件.

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.

它也与引号无关(官方回复: https://github.com/aspnet/Razor/issues/1200 ).

It has nothing to do with quotes either (official response: https://github.com/aspnet/Razor/issues/1200).

这篇关于@addTagHelper无法加载文件或程序集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆