简体   繁体   English

Visual Studio在调试时拉错CSS文件

[英]Visual Studio is Pulling Wrong CSS File on Debug

I recently had to download a new version of my site from my team explorer. 最近,我不得不从团队资源管理器中下载网站的新版本。 Now it seems to be having problems using the correct css file. 现在似乎在使用正确的CSS文件时遇到了问题。 It's as if it's looking at an older version somewhere, but I can't tell why or where it would be looking. 好像是在某个地方查看旧版本,但我无法说出其原因或查找位置。

I've checked the bundle and it has the correct file name/location. 我已经检查了捆绑包,它具有正确的文件名/位置。 I've checked the file and it has the correct code. 我已经检查了文件,并且文件具有正确的代码。

Here's my code 这是我的代码

Layout (upto Head minus analytics) 布局(最多减负分析)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title - Coverpools Dealer Portal</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />

    @Styles.Render("~/Content/magnific_css")
    @Scripts.Render("~/bundles/modernizr")
    <link href="~/Content/magnific-popup.css" rel="stylesheet" />
    @Styles.Render("~/Content/themes/base/css")
    @Styles.Render("~/Content/css")

</head>

bundles (including all, in case I'm missing something) 捆绑包(包括所有包,以防我丢失某些东西)

using System.Web;
using System.Web.Optimization;

namespace Infotech.Coverpools.Portal.Tintaglia.Web
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/quotes").Include(
                        "~/Scripts/jquery-{version}.js",
                        "~/Scripts/jquery-ui-{version}.js",
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*",
                        "~/Scripts/quotes.js"));

            bundles.Add(new ScriptBundle("~/bundles/magnific").Include(
                        "~/Scripts/jquery.magnific-popup.min.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                "~/Content/site.css",  
                "~/Content/PagedList.css", 
                "~/Content/Responsive.css", 
                "~/Content/custom.css")); // this is the custom file I believe it should be pulling

            bundles.Add(new StyleBundle("~/Content/magnific_css").Include("~/Content/magnific-popup.css"));

            bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
                        "~/Content/themes/base/jquery.ui.core.css",
                        "~/Content/themes/base/jquery.ui.resizable.css",
                        "~/Content/themes/base/jquery.ui.selectable.css",
                        "~/Content/themes/base/jquery.ui.accordion.css",
                        "~/Content/themes/base/jquery.ui.autocomplete.css",
                        "~/Content/themes/base/jquery.ui.button.css",
                        "~/Content/themes/base/jquery.ui.dialog.css",
                        "~/Content/themes/base/jquery.ui.slider.css",
                        "~/Content/themes/base/jquery.ui.tabs.css",
                        "~/Content/themes/base/jquery.ui.datepicker.css",
                        "~/Content/themes/base/jquery.ui.progressbar.css",
                        "~/Content/themes/base/jquery.ui.theme.css"));

        }
    }
}

custom.css from my local site (what it should be located in ..Web/Content/custom.css) 来自本地站点的custom.css(应该位于..Web / Content / custom.css中)

/* main layout
----------------------------------------------------------*/


/* site title
----------------------------------------------------------*/


/* login
----------------------------------------------------------*/


/* NOTICE THIS SECTION IS MISSING THE RUNNING VERSION menu
----------------------------------------------------------*/
ul#accountMenu {
    font-size: 1em;
    font-weight: 600;
    margin: 0 0 5px;
    padding: 0;
    text-align: left;
}
ul#accountMenu li {
    display: inline;
    list-style: outside none none;
    padding-left: 15px;
}
ul#accountMenu li a {
    background: rgba(0, 0, 0, 0) none repeat scroll 0 0;
    color: #999;
    text-decoration: none;
}
ul#accountMenu li a:hover {
    color: #333;
    text-decoration: none;
}


/* page elements
----------------------------------------------------------*/
/*Text*/

.important-message{
    color: red
}


/* featured */


/* page titles */


/* features */


/* ordered list */



/* content */

/* login page */

/* contact */


/* forms */


/* info and errors */


/* styles for validation helpers */


/* tables
----------------------------------------------------------*/


/********************
*   Mobile Styles   *
********************/
/*@media only screen and (max-width: 850x) { */

    /* header
    ----------------------------------------------------------*/


    /* logo */


    /* login */



    /* menu */


    /* main layout
    ----------------------------------------------------------*/


    /* page content */


    /* ordered list */


    /* features */


    /* forms */

    /* login page */



    /* mobile footer
    ----------------------------------------------------------*/

custom.css (from the running version) custom.css(从运行版本开始)

/* main layout
----------------------------------------------------------*/


/* site title
----------------------------------------------------------*/


/* login
----------------------------------------------------------*/


/* menu
----------------------------------------------------------*/



/* page elements
----------------------------------------------------------*/
/* featured */


/* page titles */


/* features */


/* ordered list */



/* content */

/* login page */

/* contact */


/* forms */


/* info and errors */


/* styles for validation helpers */


/* tables
----------------------------------------------------------*/


/********************
*   Mobile Styles   *
********************/
@media only screen and (max-width: 850x) {

    /* header
    ----------------------------------------------------------*/


    /* logo */


    /* login */



    /* menu */


    /* main layout
    ----------------------------------------------------------*/


    /* page content */


    /* ordered list */


    /* features */


    /* forms */

    /* login page */



    /* mobile footer
    ----------------------------------------------------------*/

Generated HTML upto Head 生成HTML至Head

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>All Users - Coverpools Dealer Portal</title>
    <link href="/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />

    <link href="/Content/magnific-popup.css" rel="stylesheet"/>

    <script src="/Scripts/modernizr-2.6.2.js"></script>

    <link href="/Content/magnific-popup.css" rel="stylesheet" />
    <link href="/Content/themes/base/jquery.ui.core.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.resizable.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.selectable.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.accordion.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.autocomplete.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.button.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.dialog.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.slider.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.tabs.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.datepicker.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.progressbar.css" rel="stylesheet"/>
<link href="/Content/themes/base/jquery.ui.theme.css" rel="stylesheet"/>

    <link href="/Content/site.css" rel="stylesheet"/>
<link href="/Content/PagedList.css" rel="stylesheet"/>
<link href="/Content/Responsive.css" rel="stylesheet"/>
<link href="/Content/custom.css" rel="stylesheet"/>

</head>

I even tried hardcoding custom.css but still get the same custom.css file. 我什至尝试对custom.css进行硬编码,但仍然得到相同的custom.css文件。 It's as if it's looking for the file somewhere else. 就像在其他地方寻找文件一样。

it seems like there is browser's caching issue different browser has different caching policies though your css is cached in browser so it's always get old one what i want you to do is just put ?foo=1234 at the end of your css / js import, changing 1234 to be whatever you like. 似乎存在浏览器的缓存问题,尽管您的css缓存在浏览器中,但不同的浏览器具有不同的缓存策略,因此它总是变老了,我想要您做的就是在您的css / js导入末尾放?foo=1234 ,将1234更改为您喜欢的任何值。 Have a look at the SO html source for an example. 看看SO html源代码的示例。

The idea there being that the ? 有那个想法吗? parameters are discarded / ignored on the request anyway and you can change that number when you roll out a new version. 无论如何,参数都会被丢弃/忽略,并且在您推出新版本时可以更改该数字。

OR 要么

Try to do HARD REFRESH by pressing ctrl+R | 尝试通过按ctrl+R进行HARD REFRESH | ctrl+shift+R | ctrl+shift+R | cntrl+F5 or you can find how to refresh hard on this link for different browser cntrl+F5或者您可以找到如何在此链接上为不同的浏览器重新刷新

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

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