Bundle does not render css Asp.net mvc

Asked

Viewed 999 times

5

I’ve got my own bill

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

And it just stopped working, it yields nothing

The Bundle is being registered in the global.asax

  BundleConfig.RegisterBundles(BundleTable.Bundles);

And when disabling Enableoptimizations

  BundleTable.EnableOptimizations = false;

It renders css, but without merging

  • What is generated in HTML? You don’t happen to have a folder with that name?

  • does not generate anything, and I have the folder named Content yes, until this @Style render is the default that comes when creating the project

  • in your file BlundeConfig.cs inside the briefcase App_Start ta thus bundles.Add(new StyleBundle("~/Content/css").Include(
 "~/Content/bootstrap.css",
 "~/Content/site.css"));

  • Yes Maria, this way, comes standard when generating a project Asp.net mvc 5 in visual studio, I did absolutely nothing, was working, simply stopped and did not work anymore, I do not know if updated something

  • You can check whether your Bundle is being registered correctly in Global.asax, please?

  • saw some things, and edited the question

  • You happened to create a directory called css inside Content?

  • Yes, now I saw, a lib I caught by the nuget created

Show 3 more comments

2 answers

2


Directories created by Visual Studio are managed by IIS, which prohibits the Bundling to create temporary files.

Simply delete the directory /Content/css that the Bundling will work again.

  • I didn’t understand very well, should you delete the folder and create another with another name to save the style aquives? I’ve had a similar problem, but with the scripts, it might be the same thing (but the error occurred not in place, but when publishing to the production server)?

  • No. Just delete the directory. When the directory does not exist, IIS is responsible for creating and managing it.

0

I also had this problem, and the solution went to the project settings and checked the option: "Override application root URL"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.