Tooling: VS.NET 2015 with Update 3, .NET Core 1.1.0 Razor Tag Helpers do not get colorization.

Created on 23 Nov 2016  Â·  18Comments  Â·  Source: aspnet/Tooling

Hi,
After upgrading my project to .NET Core 1.1.0, Razor Tag Helpers do not get colorization or special IntelliSense at design time.  They work normally at runtime.

global.json file:

{ "projects": [ "src", "test" ], "sdk": { "version": "1.0.0-preview2-1-003177" } }

project.json file:

{
  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },
  "dependencies": {
    "BundlerMinifier.Core": "2.2.306",
    "jQuery.UI.Combined": "1.12.1",
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Session": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore": "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.NETCore.App": "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": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },

    "Newtonsoft.Json": "9.0.1",
    "NonFactors.Grid.Mvc6": "1.3.0",
    "Npgsql.EntityFrameworkCore.PostgreSQL": "1.1.0"
  },
  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },
  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },
  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },
  "runtimes": {
    "win10-x64": {}
  },
  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },
  "tools": {
  },
  "userSecretsId": "xxxxxxxxxxxxxxxxxxxxxx"
}

Any help will be much appreciated,
AG

investigate

All 18 comments

i think i have the same problem.

I have also lost Intelisense in cshtm files for "asp-..." attributes after migration to .NET core 1.1

/cc @NTaylorMullen @ToddGrun

@mlorbetske any idea what I can do to make it work again? (vs2015)

@wstaelens unfortunately I'm not sure myself, but the two people I looped in are the experts and should be able to help

@wstaelens can you provide a repro for me to look at?

my extensions and updates of VS doesn't have any updates. All updates installed.

Visual Studio 2015 v 14.0.25431.01 update 3
Nuget package manager for visual studio v 3.5.0.1484

My project.json:

{
  "userSecretsId": ":-)",

  "dependencies": {
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Mvc.Core": "1.1.0",
    "Microsoft.AspNetCore.Mvc.Razor": "1.1.0",
    "Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
    "Microsoft.AspNetCore.Razor": "1.1.0",
    "Microsoft.AspNetCore.Razor.Runtime": "1.1.0",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore": "1.1.0",
    "Microsoft.EntityFrameworkCore.Design": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": "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.NETCore.App": "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": {
    "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.0.0-preview3-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.1.0-preview4-final",
      "imports": [
        "portable-net45+win8+dnxcore50",
        "portable-net45+win8"
      ]
    },
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final"
  },

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

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

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

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },
  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  },
  "runtimes": {
    "win10-x64": {}
  }
}

hope this helps.

Quick note. I ran into this exact same issue (lost razor colorization/intellisense when upgrading to 1.1.0). I was able to get it working by making sure I had the following two items in my project.json (unrelated sections removed):

 "dependencies": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.1.0-preview4-final",
      "type": "build"
    },
  "tools": {
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final"
  }

Without that combination (as well as having the @addTagHelper peice), I could not get it to work.

Thanks you RemyArmstro, it is working!

Thanks @RemyArmstro , after adding "dependencies" part and rebuilding the project, I have tag helpers working again !

I ran into this problem and I tried @RemyArmstro 's solution and it's not working. !

Having same issue... no intellisense for TagHelpers in Razor e.g. <a asp-controller="" asp-action=""> since upgrading project to 1.1.0. My project.json already has the items that @RemyArmstro notes. My global.json is using sdk version "1.0.0-preview2-1-003177"

@jmalatia did you upgrade all of your dependencies to their 1.1.0 equivalents?

@NTaylorMullen, I thought I did... but there was two I missed that were still 1.0.0.

"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"
}

updated to:

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

And intellisense is now working for TagHelpers on <a asp-controller="" asp-action="">

My bad. Thanks for the nudge to double check what I thought I already triple-checked!

How to make it work with Visual Studio 2017 release where VS 2017 using MSBuild instead of project.json?

This is not supported in VS2017 yet (at least according to comment #920).

Tag helper intellisense is currently available as an extension for VS2017 at https://aka.ms/razorlangsvc

Still on vs2015 for a while...

Was this page helpful?
0 / 5 - 0 ratings