从ASP.NET Core 1.0升级到1.1后,Tag Helper智能感应不起作用

从ASP.NET Core 1.0 to 1.1升级后。但Tag Helper Intellisense不起作用。什么可能会丢失?:从ASP.NET Core 1.0升级到1.1后,Tag Helper智能感应不起作用

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%" ]

}

}

UPDATE:

_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 1.1的核心

还有一张纸条就在包装前节Eric Anderson关于智能感知相关问题的文章here。不知道这是否与此有关。

回答:

问题与Microsoft.AspNetCore.Razor.Tools。

你拥有了它的相关性,但是你需要把它添加到工具也:

"tools": { 

"BundlerMinifier.Core": "2.0.238",

"Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final"

},

回答:

这是我必须配置我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决赛。

另请注意,正如@Alex所述,您还需要在“工具”中指定* .Razor.Tools。 我希望这可以帮助。这确实很糟糕。

忍者编辑:不要忘了建立你的项目,intellisense不会工作,直到你做。可能还必须关闭并重新打开这些文件。

回答:

在我的情况下,我有针对性net46,然后当我改变为net461,它再次工作。我也添加版本和导入到包部分。

"tools": { 

"Microsoft.AspNetCore.Razor.Tools": {

"version": "1.1.0-preview4-final",

"imports": ["portable-net45+win8"]

},

回答:

只是一个说明,上述问题直到我安装了Razor语言服务才解决了我的问题。现在一切正常。

https://marketplace.visualstudio.com/items?itemName=ms-madsk.RazorLanguageServices

不知道这是一个要求仍在,但我也安装了剃刀工具。 它安装了截至2017年5月1日的Preview4-final。

安装软件包Microsoft.AspNetCore.Razor.Tools -Pre

以上是 从ASP.NET Core 1.0升级到1.1后,Tag Helper智能感应不起作用 的全部内容, 来源链接: utcz.com/qa/259665.html

回到顶部