简体   繁体   中英

Bootstrap Intellisense Missing Visual Studio 2015

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?

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.

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

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

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.

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!

在此输入图像描述

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM