语法突出显示和智能感知不工作.net 核心与 2015
Syntax highlighting and intellisense not working .net core vs 2015
我正在尝试处理 .net 核心项目,但语法突出显示对于 razor 视图无法正常工作。是否缺少我缺少的开发依赖项或配置 属性。对于 asp-* 标签,Intellisense 也无法正常工作。有什么建议么?我已经尝试删除 appdata 中的 ComponentModelCache。
这是我的 project.json,这样您就可以看到我使用的是什么包。它似乎与项目设置相关,很可能是一个包。我正在我的 _ViewImports.cshtml 文件中导入标签助手。我只是不确定这个项目与默认的 .NET Core 项目相比有什么不同。这个项目是从一个空的网络核心项目开始的。
{
"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%" ]
}
}
你有安装Resharper吗?它和 .NET Core 语法突出显示和智能感知似乎有问题。
http://blog.jetbrains.com/dotnet/2016/05/27/resharper-ultimate-2016-2-eap-kicks-off/
Initial support of ASP.NET Core 1.0 RC2, including support for tag helpers in terms of code completion, navigation, search and refactorings. At this point, ASP.NET Core web applications are supported if they’re targeting .NET Framework but are not supported if they’re targeting .NET Core. We’re looking to improve this in subsequent builds.
因此,如果您有针对 .netstandard1.5
的库,Resharper 将无法正确显示智能感知信息,但项目会编译。
但是,如果您将 .netcoreapp1.0
框架作为附加框架添加到 project.json
文件中,Resharper 将工作并且您将获得完整的智能感知支持。
frameworks": {
"netstandard1.5": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Security.Principal": "4.0.1-rc2-24027"
}
},
".netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
},
在尝试不同的软件包并搜索论坛和问题线程数小时后,我试了一下这个软件包 Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final
,这似乎可以解决问题。一旦我引用了这个包,所有的语法高亮似乎都生效了。
我正在尝试处理 .net 核心项目,但语法突出显示对于 razor 视图无法正常工作。是否缺少我缺少的开发依赖项或配置 属性。对于 asp-* 标签,Intellisense 也无法正常工作。有什么建议么?我已经尝试删除 appdata 中的 ComponentModelCache。
这是我的 project.json,这样您就可以看到我使用的是什么包。它似乎与项目设置相关,很可能是一个包。我正在我的 _ViewImports.cshtml 文件中导入标签助手。我只是不确定这个项目与默认的 .NET Core 项目相比有什么不同。这个项目是从一个空的网络核心项目开始的。
{
"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%" ]
}
}
你有安装Resharper吗?它和 .NET Core 语法突出显示和智能感知似乎有问题。
http://blog.jetbrains.com/dotnet/2016/05/27/resharper-ultimate-2016-2-eap-kicks-off/
Initial support of ASP.NET Core 1.0 RC2, including support for tag helpers in terms of code completion, navigation, search and refactorings. At this point, ASP.NET Core web applications are supported if they’re targeting .NET Framework but are not supported if they’re targeting .NET Core. We’re looking to improve this in subsequent builds.
因此,如果您有针对 .netstandard1.5
的库,Resharper 将无法正确显示智能感知信息,但项目会编译。
但是,如果您将 .netcoreapp1.0
框架作为附加框架添加到 project.json
文件中,Resharper 将工作并且您将获得完整的智能感知支持。
frameworks": {
"netstandard1.5": {
"imports": [ "dnxcore50", "portable-net45+win8" ],
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Security.Principal": "4.0.1-rc2-24027"
}
},
".netcoreapp1.0": {
"imports": [ "dnxcore50", "portable-net45+win8" ]
}
},
在尝试不同的软件包并搜索论坛和问题线程数小时后,我试了一下这个软件包 Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final
,这似乎可以解决问题。一旦我引用了这个包,所有的语法高亮似乎都生效了。