1

I am trying to use MVC bundling and minification in SP2013 I don't know if I can ! I took code from simple webform aplication that work and tried make it work in my project : spcode:

 public static void RegisterBundles(BundleCollection bundles)
    {
        string PATH = "/_layouts/15/SiteInfo/CSS_debug/" ;
        string version = "9.2";

        BundleTable.Bundles.Add(new StyleBundle("~" + PATH + "/bundles/name").Include(
        "~" + PATH + "1.css" + version,
        "~" + PATH + "2.css" + version,
        "~" + PATH + "3.css" + version,
        "~" + PATH + "4.css" + version,
        "~" + PATH + "5.css" + version,
        "~" + PATH + "6.css" + version,
        "~" + PATH + "7.css" + version,
        "~" + PATH + "8.css" + version

     )); 

and then use it : Styles.Render("~" + PATH + "/bundles/moshe") which give .net error page

Exception Details: System.ArgumentException: virtualPath

or if I use

Styles.Render("~/" + PATH + "/bundles/moshe") will just render script tag with /_layouts/15/SiteInfo/CSS_debug/bundles/moshe that of course not found

what am Im missing?

  • Sorry question is not clear. Are you trying to add MVC routes/bundling inside SharePoint website or are you doing it for an provider hosted app? – Alok Kumar Gupta Mar 28 '17 at 10:24
  • I was wondering if I can use MVC system.web.optimization class for bundling and minification - so I started playing with is . its not proveider hosted app -sp base site – Adleron Mar 28 '17 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.