Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Brenton Mumford 19 posts 40 karma points
    Jul 08, 2013 @ 23:34
    Brenton Mumford
    0

    No Bundle Renders, Compilation Error Creating Bundle inside Masterpage

    First off, holy crap, you guys. This package is going to be awesome.

    Here's what I've found so far.

    First off, based on the documentation I was able to find, I expected to be able to just drop 

    @Styles.Render("~/bundles/bundleOne")

    right into the masterpage after installing the package, and having spit out, like, whatever was in my bundle. That didn't happen - it just left it right like that in the HTML. So I figured I didn't understand.

    Right about then I found the 'create a bundle' button in the Template editor. (High five on that idea, by the way. That couldn't be easier. Like, whoa. There's almost literally no excuse not to bundle up code now. Unbelievable.)

    So, after I do that automatic bundle button thing, when I pull up the page, I get 

    Server Error in '/' Application.
    
    Compilation Error
    
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
    
    Compiler Error Message: CS0103: The name 'Styles' does not exist in the current context
    
    Source Error:
    
    
    Line 12:        <title>Test Page</title>
    Line 13:        <meta name="description" content="">
    Line 14:        <%: Styles.Render("~/bundles/bundleOne") %>
    Line 15:        <link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700" rel="stylesheet" type="text/css"> 
    Line 16: 
    
    Source File: c:\Documents and Settings\Server\My Documents\My Web Sites\Umbraco CMS with Optimus\Masterpages\ACO-Master.master    Line: 14 

    So those are my bugs. I don't have any ideas on how to try and fix "Compiler Error Message: CS0103: The name 'Styles' does not exist in the current context." 

    This is a quick and dirty 6.1.2 running on WebMatrix 2.0. I THINK I got all the manual adds to the two web.configs correct - most pertinently the <add namespace="System.Web.Optimization" /> at configuration > system.web.webPages.razor > pages > namespaces in views/web.config. I double-checked all the adds, but I'd be happy to triple check anything if you suggest that may be the issue.

    Thanks a bunch, guys. The back office stuff is looking really, really good. In my super humble opinion, this has 'added to the core for v7.0' written all over it. Because, dang.

  • Brenton Mumford 19 posts 40 karma points
    Jul 08, 2013 @ 23:41
    Brenton Mumford
    0

    By the way, I installed both SASS and LESS for this runthrough, but neither of the script providers.

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Jul 09, 2013 @ 10:13
    Tim Geyssens
    0

    Hi Brenton,

    Almost there, you'll also need this in your web.config (in the pages element)

    <namespaces><addnamespace="System.Web.Optimization"/></namespaces>

    And the code you need to include it on a masterpage is

    <%: Styles.Render("~/bundles/myBundle") %>
  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Jul 09, 2013 @ 10:14
    Tim Geyssens
    0

    Ah the editor ate my formating, web.config addon will look like this (makes sure the namespace is included on your masterpages system.web/pages element)

     

               

               

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Jul 09, 2013 @ 10:16
    Tim Geyssens
    0

    Should be done automatically friday when we release the stable version ;) thanks for the feedback!

  • Brenton Mumford 19 posts 40 karma points
    Jul 09, 2013 @ 16:50
    Brenton Mumford
    0

    I saw that you were going to get it automated by Friday, I'm just super impatient. Been hoping someone(s) smarter than me would create something exactly like this for a while now.

    And, you should know ... IT WORKS! Yes!

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Jul 09, 2013 @ 16:51
    Tim Geyssens
    0

    Sweet, thanks for confirming :)

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Jul 09, 2013 @ 16:56
    Tim Geyssens
    0

    And don't forgot to vote for the package if you like it ;)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies