twitter-bootstrap Bootstrap Intellisense 缺少 Visual Studio 2015

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31822482/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 23:01:43  来源:igfitidea点击:

Bootstrap Intellisense Missing Visual Studio 2015

csstwitter-bootstraprazorvisual-studio-2015smartadmin

提问by Shane Van Wyk

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

我本周安装了 Visual Studio 2015。但是我发现我的 Razor 视图中没有智能感知。

In Visual studio 2013 it worked fine.

在 Visual Studio 2013 中它运行良好。

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

我所有的 css 文件都在~/Content/css/( *.min.css) 下,包括引导程序。

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.

当我尝试在我的 razor 视图中使用一些引导 css 时,自动完成框中没有任何内容弹出。bootstrap 类旁边应该有一个紫色的图标对吧..?bootstrap 包下没有列出任何图标和 css 类。

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

我做了一个健全性检查并创建了一个新的 MVC 5 应用程序。这随引导程序一起提供。这有效,所有的智能感知都在那里。

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?

我该如何解决这个问题?肯定是我的解决方案有问题?它不喜欢css文件在内容下的子文件夹下吗?

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?

更新:所以我复制了文件的未缩小版本,然后它被捡起来了。所以有人知道VS不为智能感知选择缩小文件的原因吗?

回答by Shane Van Wyk

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.

似乎解决方案是将非缩小的文件添加到您的解决方案中,以便智能感知工作。我认为这是由于 Microsoft 将 minifier 拆分为单独的扩展。

回答by Ahsan Sarfraz

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:

如果您的项目类型是 ASP.NET Web 应用程序并且您使用的是“母版页”,那么简单的解决方法是在母版页中添加一个指向 css 文件的链接。例如,在母版页的“head”部分,我添加:

<link rel="stylesheet" href="Content/bootstrap.css" type="text/css" />

回答by Berlstone

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.

使用旧版编辑器的 ASPX 和其他 WebForm 文件不会从 VS 2013 中的此实现中受益,但可能会在未来版本中采用新系统。

But you can still use this feature as follows:

但是您仍然可以按如下方式使用此功能:

right click on the default.aspxfile in the Solution Explorer open withselect HTML Editorok

右键单击default.aspx解决方案资源管理器中的文件 open with选择HTML Editorok

回答by fiffens

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.

就我而言,我必须从解决方案中删除数据库项目 (.sqlproj) 才能使 Bootstrap css 类智能感知工作。

Remove the database project then restart Visual Studio.

删除数据库项目,然后重新启动 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.

并且要清楚。这不是一个好的解决方案,因为删除数据库项目不是您想要的。所以,希望有人能找到解决这个奇怪错误的好方法。

回答by Riccardo Bassilichi

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

在此处输入图片说明

回答by Ravi Shankar Kota

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.

之后,我关闭了 Visual Studio 解决方案并重新打开它。Intelli-sense 之后开始为引导程序工作。

回答by Beeg

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.

什么对我有用:链接到完整的引导 css,关闭视图,重建解决方案,打开视图。智能感知工作。更改为缩小的 css,关闭视图,重建,打开视图。智能感知仍在工作。