8

I installed Visual Studio 2015 this week. However I discovered that I have no intellisense in my Razor Views.

In Visual studio 2013 it worked fine.

My all my css files are under ~/Content/css/ (*.min.css), including bootstrap.

Here is the bundle config:

bundles.Add(new StyleBundle("~/Content/smartadmin").IncludeDirectory("~/Content/css", "*.min.css"));

When I try to use some bootstrap css in my razor view, nothing pops up in the autocomplete box. There should be a purple icon next to the bootstrap classes right..? There are no icons and no css classes listed which is available under the bootstrap package.

I did a sanity check and created a new MVC 5 application. This comes shipped with bootstrap. This works, all the intellisense is there.

How do i fix this issue? Surely it must be a problem with my Solution? Does it not like the css files to be under a sub folder under content?

UPDATE: So i copied in the unminified versions of the files, then it got picked up. So anyone know the reason why VS does not pick up minified files for intellisense?

Shane van Wyk
  • 1,870
  • 1
  • 26
  • 62
  • 1
    Probably also worth mentioning to try a newly created page to see if the intellisense is working in that. If it is then it may be that the page structure has gone wrong and the page needs to be rebuilt. – CYoung Dec 09 '16 at 00:12

7 Answers7

10

It seems like the solution is to add non-minified Files to your solution in order for intellisense to work. I think it is due to Microsoft splitting out the minifier into a separate extension.

Shane van Wyk
  • 1,870
  • 1
  • 26
  • 62
6

If your project type is an ASP.NET web application and you are using a 'Master page', the easy fix is to add a link to the css file in the master page. For example, in the master page 'head' section I add:

<link rel="stylesheet" href="Content/bootstrap.css" type="text/css" />
Kevin
  • 2,258
  • 1
  • 32
  • 40
Ahsan Sarfraz
  • 61
  • 1
  • 2
4

ASPX and other WebForm files using the legacy editor do not benefit from this implementation in VS 2013, but may adopt the new system in future releases.

But you can still use this feature as follows:

right click on the default.aspx file in the Solution Explorer open with select HTML Editor ok

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
Berlstone
  • 129
  • 1
  • 6
3

If someone comes here and the accepted solution doesn’t work.

In my case I had to remove the database project (.sqlproj) from the solution for the Bootstrap css class intellisense to work.

Remove the database project then restart Visual Studio.

And to be clear. This is not a good solution as removing the database project is not what you want. So, hope someone finds a good solution to this weird bug.

fiffens
  • 123
  • 1
  • 1
  • 6
  • That is so strange, I didn't have a database project at all when I was experiencing this issue. Its all gone downhill when they started messing with the minifier – Shane van Wyk Oct 11 '16 at 02:25
  • Same thing happened here and removing the database project fixed it. How on earth this happened I don't know. I created the database schema using the import function. – Noobie3001 Oct 12 '16 at 19:05
  • I can't explain why but, in my case, removing the SQL Server project from the solution also solved the issue. Now I have two instances of VS2015 running. One for the model-persistence-web api and the other for the web angular and mobile app client projects. – JoeCool Nov 15 '16 at 21:04
  • 1
    omg this worked for me. that is super lame. i just hit unload on the database project and the bootstrap intellisense started working. wtf. – Nick Molyneux Jan 17 '17 at 22:12
3

In my case, the intellisense not worrk because the path of bootstrap files was changed then files are not included in the project.

After adding files to the project works fine.

I know... It is a simple solution. Sorry!

enter image description here

1

I got it worked by ensuring all actual scripts are in place and in order.

<script src="Scripts/jquery-3.2.1.js"></script>
<script src="Scripts/bootstrap.js"></script>
<script src="Scripts/angular.js"></script>

<link href="Content/bootstrap-theme.css" rel="stylesheet" />
<link href="Content/bootstrap.css" rel="stylesheet" />

After that I closed the visual studio solution and reopened it.Intelli-sense started working for bootstrap afterwards.

0

What worked for me: Link to the full bootstrap css, close the view(s), rebuild the solution, open the view. Intellisense worked. Change to the minified css, close the view, rebuild, open the view. Intellisense still working.

Beeg
  • 11
  • 2