gpt4 book ai didi

visual-studio-2015 - 从 ASP.NET Core 1.0 升级到 1.1 后,Tag Helper Intellisense 不工作

转载 作者:行者123 更新时间:2023-12-02 15:15:41 24 4
gpt4 key购买 nike

ASP.NET Core 1.0 to 1.1升级后.但是 Tag Helper Intellisense 不起作用。可能缺少什么?:

project.json

{
"userSecretsId": "aspnet-ABCTest-6af8ade3-87ff-4468-a9ce-8bb69c696ab8",

"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"type": "platform"
},
"Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.Core": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.1.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Identity": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": "1.1.0-preview4-final",
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-preview4-final" },

"tools": {
"BundlerMinifier.Core": "2.0.238"
},

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

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

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

"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},

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

更新:

_ViewImports.cshtml:

@using myProj
@using myProj.Models
@using myProj.Models.AccountViewModels
@using myProj.Models.ManageViewModels
@using myProj.AspNetCore.Identity
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

构建工作正常。标签助手也可以工作,但我必须对属性进行硬编码,例如 asp-controllerasp-actionasp-forasp-items 等。在我迁移到 ASP.NET Core 1.1 之前它一直在工作

在 Eric Anderson 的文章 here 的包装部分之前还有一个注释关于智能感知相关问题。不确定这在这里是否相关。

最佳答案

这就是我必须如何配置我的 project.json 以获得标签助手智能感知:请注意注释掉的行 - 与未注释的等效行:

    "dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.Core": "1.1.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.Razor": "1.1.0",
"Microsoft.AspNetCore.Razor.Design": "1.0.0-preview3-final",
//"Microsoft.AspNetCore.Razor.Design": "1.1.0-preview4-final",
"Microsoft.AspNetCore.Razor.Runtime": "1.1.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
//"version": "1.1.0-preview4-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.Session": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0"
},

"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final"
//"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final"
},

因此,基本上,*Razor.Design 和 *Razor.Tools 都必须保持在 1.0.0-preview3-final。

另请注意,如@Alex 所述,您还需要在“工具”中指定 *.Razor.Tools。我希望这有帮助。这肯定是无赖。

Ninja 编辑:不要忘记构建您的项目,因为在您这样做之前,智能感知不会起作用。可能还必须关闭并重新打开文件。

关于visual-studio-2015 - 从 ASP.NET Core 1.0 升级到 1.1 后,Tag Helper Intellisense 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40825116/

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