Search code examples
c#asp.netbundles

Asp.net Error while trying to create a bundle - Only application relative URLs (~/url) are allowed


I am getting an error, when trying to include a css file in the bundle, it says that Asp.net MVC Bundle - Only application relative URLs (~/url) are allowed.

Here is the code:

bundles.Add(new StyleBundle("~/bundles/lib/anim_css").Include(
                "~Vendor/lib/animate/animate.min.css", new CssRewriteUrlTransform()));

Where the Vendor folder is the source folder of that css. That folder is included in the project, being like that ...ProjectFolderName/Vendor

This did not help


Solution

  • ~Vendor/lib/animate/animate.min.css is not a legal relative URL. It needs to be ~/Vendor/lib/animate/animate.min.css