24

I've installed Bootstrap via the Microsoft CDN like:

<head>
    ...
   <link href="//ajax.aspnetcdn.com/ajax/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
   <link href="//ajax.aspnetcdn.com/ajax/bootstrap/3.1.1/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
</head>

and

<body>
    ...
    <script src="//ajax.aspnetcdn.com/ajax/bootstrap/3.1.1/bootstrap.min.js"></script>
</body>

Everything is working fine with Bootstrap, however, Visual Studio isn't giving me any kind of intellisense for the classes.

For example, typing

<div class="(intellisense should open here)

nothing comes up.

Is there any way to get intellisense from the CDN?

Ravimallya
  • 6,550
  • 2
  • 41
  • 75
Scottie
  • 11,050
  • 19
  • 68
  • 109

10 Answers10

33

If you are working with ASP.NET Core project do as follows. VS only reference files inside the wwwroot folder. You need to open the .csproj file and add the following code segment.

<ItemGroup>
  <None Include="node_modules/**" />
</ItemGroup>

After that VS will picking up intellicen from node_modules.

Shanaka Rathnayaka
  • 2,462
  • 1
  • 23
  • 23
11

You can add CDN references to intelliSence for javascript, however, css is not supported.

Visual Studio 2013 options

You can add the file to your project and it will work, you dont need to add a ref to html, just to project and it should resolve your issue.

Samuel Pinto
  • 987
  • 11
  • 8
  • Can you use {version} in this? – Scottie Jan 07 '15 at 21:08
  • 7
    The `JavaScript\IntelliSense\References` node is not present in Visual Studio 2017. Even translating the `JavaScript` to `JavaScript/TypeScript` in the aforementioned path does not find the `References` node. I'm thinking that MS removed it. – Zarepheth Jul 19 '17 at 16:33
5

You need to install bootstrap through the NuGet Packages. Intellisense will start working after that.

mjdev
  • 149
  • 2
  • 8
1

Open Visual Studio

Go in Extensions and Updates and then click on Online Tab.

In Search type Bootstrap.

Install following Packs to enable intellisense. Ensure that you have dragged bootstrap.css (or bootstrap.min.css and js file) before trying to insert snippet.

  • Bootstrap Bundle
  • Bootstrap Snippet Pack

enter image description here

Camilo Terevinto
  • 31,141
  • 6
  • 88
  • 120
vibs2006
  • 6,028
  • 3
  • 40
  • 40
1

I just installed the bootstrap nuget

Mocas
  • 1,403
  • 13
  • 20
0

TOOLS->Options->Text Editor->the specific language ->IntelliSense

That should get the intellisense back up and running, worked for me before (think this is what you are looking for)

  • I know you answered "...-> **the specific language** ->IntelliSense" but **CSS** doesn't seem to have the IntelliSense-option-alernative? – Hauns TM Dec 22 '14 at 21:48
  • what version of VS are you using? 2012? 2013? –  Dec 23 '14 at 15:55
  • I have Visual Studio 2013 – Hauns TM Dec 26 '14 at 00:41
  • Hi Hauns, there was a change between 2012 and 2013, this answer is the best I could offer, click the link: [link](http://stackoverflow.com/a/21571678/4157770) - hope it helps! –  Dec 28 '14 at 05:37
0

I know this way is not exactly CDN, but it worked for me and you can still keep your packages up-to-date

You can reference Bootstrap using Bower.

On the package.json you would have:

{
  "version": "1.0.0",
  "name": "TaskAngularJSApp",
  "private": true,
  "devDependencies": {
    "grunt": "0.4.5",
    "grunt-contrib-uglify": "0.7.0",
    "grunt-contrib-watch": "0.6.1",
    "bower": "1.7.3"
  }
}

Then you have bower.json file like:

{
    "name": "ASP.NET",
    "private": true,
    "dependencies": {
        "bootstrap": "*"
    }
}

Then on your html you would reference bootstrap like

    <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css" />
    <script src="/lib/bootstrap/dist/js/bootstrap.min.js"></script>

I got help from: using grunt bower gulp npm with visual studio 2015 for a asp-net-4-5-project

and

Released Today: Visual Studio 2015, ASP.NET 4.6, ASP.NET 5 & EF 7 Previews - On the "HTML Editor Updates" section

Community
  • 1
  • 1
dvgrape
  • 63
  • 2
  • 9
0

In the Content folder copy bootstrap.css.

Tonatio
  • 4,026
  • 35
  • 24
0

The inclusion of the old Razor editor in the HTML settings helped me - https://github.com/dotnet/razor-tooling/issues/5669

kisva
  • 1
0

Go to TOOLS->Options->Text Editor->HTML->Advanced->Razor-> Select True

enter image description here