Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/318.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# mvc以部分方式从捆绑包中排除css_C#_.net_Asp.net Mvc_Asp.net Mvc 4_Bundle - Fatal编程技术网

C# mvc以部分方式从捆绑包中排除css

C# mvc以部分方式从捆绑包中排除css,c#,.net,asp.net-mvc,asp.net-mvc-4,bundle,C#,.net,Asp.net Mvc,Asp.net Mvc 4,Bundle,抱歉,我完全是mvc中的noob,我需要从我的视图中排除一个主样式包: 添加(新样式包(“~/Content/css”)。包括(“~/Content/site.css”) 从我的一个视图页面在_Layout.cshtml中呈现。查看页面是一个照片库。它有自己的css,这与核心site.css冲突。我已经尝试插入: @{BundleTable.Bundles.IgnoreList.Ignore(“~/Content/css”);}或@{BundleTable.Bundles.IgnoreList.

抱歉,我完全是mvc中的noob,我需要从我的视图中排除一个主样式包:

添加(新样式包(“~/Content/css”)。包括(“~/Content/site.css”)

从我的一个视图页面在_Layout.cshtml中呈现。查看页面是一个照片库。它有自己的css,这与核心site.css冲突。我已经尝试插入:

@{BundleTable.Bundles.IgnoreList.Ignore(“~/Content/css”);}
@{BundleTable.Bundles.IgnoreList.IgnoreList.Ignore(“site.css”);}

到我的照片库页面,但在第一种情况下,我什么也没有得到,在第二种情况下,mvc完全忽略所有捆绑包排除我的照片库css

除了使用不同的_Layout.cshtml之外,还有什么简单的方法来处理它吗

除了使用不同的_Layout.cshtml之外,还有什么简单的方法来处理它吗

否,一旦包含了一个包,它将在标记中呈现


您当然不想修改
IgnoreList
,因为这是一个全局属性,更改它会影响应用程序中的所有其他页面。

虽然这可能不是一件小事,我使用的一种方法是在main site.css之后和新的css文件之前包含一个重置css文件,该文件取消了您不想要的site.css属性。