gpt4 book ai didi

asp.net - .Net Core 标记助手智能感知和颜色编码不起作用

转载 作者:行者123 更新时间:2023-12-03 21:36:26 25 4
gpt4 key购买 nike

我在使用 .NET 核心和标签助手时遇到问题。当我输入 asp-for 时,颜色编码和智能感知没有显示或注册。我尝试在一个单独的实例中创建一个新的解决方案,验证了智能感知的工作原理,然后将 project.json 复制到没有智能感知/颜色编码的项目中,它并没有解决问题。

这是我的 project.json

{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},

"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
}
},

"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},

"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},

"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},

"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},

"scripts": {
"prepublish": [ "bower install" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}

我还在 _ViewImports 文件中为 mvc 标签助手进行了引用/注入(inject)。这是我正在测试它是否有效的 View 。
enter image description here

这是我的项目结构,以防万一你能看到我没有看到的东西。

enter image description here

如果它有帮助,这是我正在使用的 Visual Studio 版本。

enter image description here

最佳答案

我必须安装 Microsoft.AspNetCore.Mvc.TagHelpers 并在 中添加以下行_ViewImports.cshtml 文件

@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

关于asp.net - .Net Core 标记助手智能感知和颜色编码不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40924211/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com