我已将我的 asp.net 核心 Web 应用程序从 1.0.1 更新到 1.1.0,但我的视图组件的标签助手不起作用:
<vc:login-form />
它输出标签。它使用旧语法工作:@await Component.InvokeAsync(typeof(LoginFormViewComponent))
我错过了什么?
包.json:
{
"title": "DevPortal.Web",
"version": "0.1.0",
"language": "",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"NuGet.CommandLine": "3.5.0",
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final"
},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"scripts": {
"prepublish": [ "bower install"],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"userSecretsId": "aspnet-DevPortal.Web-20161230052130"
}
我已将此添加到 _ViewImports.cshtml:
@addTagHelper "*, DevPortal"
我的程序集名称是 DevPortal.dll
[ViewComponent(Name ="LoginForm")]
public class LoginFormViewComponent: ViewComponent
{
public IViewComponentResult Invoke(LoginFormViewModel model = null)
{
if (model == null) model = new LoginFormViewModel();
return View(model);
}
}