简体   繁体   English

Visual Studio Express 2013 CSS Intellisense无法正常工作

[英]Visual Studio Express 2013 CSS Intellisense not working

I have VS Express 2013 installed with update 1. In a brand new Web Forms project, CSS intellisense doesn't work for anything other than styles defined within the page. 我安装了带有更新1的VS Express2013。在一个全新的Web Forms项目中,CSS intellisense除了页面中定义的样式外,不适用于其他任何内容。 The Bootstrap styles are showing when I run the page so I know the styles are bundled properly. 我在运行页面时会显示Bootstrap样式,因此我知道样式已正确捆绑。 When I create a new MVC project, the CSS Intellisense works properly. 当我创建一个新的MVC项目时,CSS Intellisense可以正常工作。 Any ideas why Intellisense doesn't pick up Bootstrap or anything else for that matter in Web Forms? 有什么想法为什么Intellisense无法在Web Forms中使用Bootstrap或其他任何东西? Are there settings settings I can change? 有可以更改的设置设置吗? Thanks. 谢谢。

I had the same problem. 我有同样的问题。 I tried resetting VS settings, reinstalling Bootstrap etc. Which didn't work. 我尝试重设VS设置,重新安装Bootstrap等。这没有用。 I also tried using the MVC Bundeling <%:Styles.Render("~/Content/css") %> that didn't work... 我还尝试了使用无效的MVC Bundeling <%:Styles.Render(“〜/ Content / css”)%>。

In the end I used this hack... I added the below to the master page. 最后,我使用了这种技巧...我将以下内容添加到了母版页中。

Under this: webopt:bundlereference runat="server" path="~/Content/css" /> 在此下:webopt:bundlereference runat =“ server” path =“〜/ Content / css” />

**<link href="Content/bootstrap.css" rel="stylesheet" />
<link href="Content/Site.css" rel="stylesheet" />**

Works fine, just remember to remove them on release, or when someone finds a better fix. 效果很好,只是记得在发布时或在发现更好的修复程序时将其删除。

I use the #if DEBUG directive. 我使用#if DEBUG指令。 The web.config and web.release.config controls the rest (debug=true|false). web.config和web.release.config控制其余部分(debug = true | false)。 I always get intellisense when coding and bundled css when publishing. 我总是在编码时得到智能感知,并在发布时捆绑成CSS。

HTML: HTML:

<head>
    <title><%: Page.Title %></title>

    <% #if DEBUG %>
    <link rel="stylesheet" href="~/Content/bootstrap.css"  />
    <link rel="stylesheet" href="~/Content/site.css"  />
    <% #else %>
    <webopt:BundleReference runat="server" Path="~/Content/css" />
    <% #endif %>
</head>

Web.config: Web.config文件:

<compilation debug="false" targetFramework="4.5" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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