2013-02-19 207 views
1

我配置了一个mvc样式包。这个包为什么不起作用?

它包含两个css文件。这里是有问题的软件包:

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css", "~/Content/jasmine.css")); 

这些文件之间实际上没有区别。

这是我在我的布局捆绑的用法:

@Styles.Render("~/Content/css") 

打开Chrome检查,我觉得这一点:

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

但是,没有jasmine.css。

什么问题?为什么不包括我的文件?

编辑

下面是该文件夹的截图:

enter image description here

+0

您是否有权访问URL助手选择文件? – 2013-02-19 20:51:17

+0

protip和无耻的插件:我有一个[问题](http://stackoverflow.com/questions/11104879/mvc4-bundling-strongly-typed-bundles)关于你可能感兴趣的强类型包 – Eonasdan 2013-02-19 21:45:28

回答

1

我已经看到这种情况发生时,文件丢失或我指定了错误的道路。验证路径为"~/Content/jasmine.css"

+0

确实,检查文件存在于磁盘上。我只是尝试用@Robo描述的确切场景构建一个MVC4应用程序,并且它工作正常,我同时获得了参考。 – Eilon 2013-02-19 21:27:31

+0

查看vs解决方案资源管理器截图。 – BentOnCoding 2013-02-20 04:11:52

1

您可以使用每个内容或脚本的.Include("~/ContentAddress"),以便将其添加到您的包中。

bundles.Add(new StyleBundle("~/Content/css") 
.Include("~/Content/site.css") 
.Include("~/Content/jasmine.css"));