I am trying to work on a .net core project and syntax highlighting is not functioning properly for razor views. Is there a dev dependency or configuration property that I am missing. Intellisense is also not working properly for asp-* tags. Any suggestions? I've already tried deleting the ComponentModelCache in appdata.
Here is my project.json so you can see what packages I'm using. It seems to be project setup related, most likely a package. I am importing the tag helpers in my _ViewImports.cshtml file. I'm just not sure what's different in this project compared to default .NET Core projects. This project was started with an empty web core project.
{
"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%" ]
}
}
After hours of trying different packages and searching forums and issue threads, I gave this package a shot
Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final
and this seemed to do the trick. All the syntax highlighting seemed to take effect once I referenced this package.Do you have Resharper installed? It seems there's a problem with it and .NET Core syntax highlighting and intellisense.
http://blog.jetbrains.com/dotnet/2016/05/27/resharper-ultimate-2016-2-eap-kicks-off/
So if you have a library targeting
.netstandard1.5
Resharper will not correctly display intellisense information but the project will compile.However if you add the
.netcoreapp1.0
framework as an additional framework to theproject.json
file Resharper will work and you get full intellisense support.How to fix intellisense with referenced netstandard1.5 library projects in Visual Studio 2015?