Copied to clipboard

Flag this post as spam?

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


  • Craig100 1136 posts 2523 karma points c-trib
    Sep 21, 2012 @ 21:53
    Craig100
    0

    WebMatrix 2 Upgraded .NET framework now macros won't run

    Hi,

    I stupidly allowed WebMatrix 2 to upgrade a site to work with .NET framework 2 from 1 now Razor macros won't run. It's an Umbraco 4.7.2 site which is running on a dev machine, the IIS of which is 7.5 and running .net 4 on the application pool.  What could have gone wrong to cause this? The warning said that code changes might need to be made to make the site run on the new framework but I can't work out what it would be.

    Any help would be appreciated.

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    Sep 21, 2012 @ 22:54
    Craig100
    0

    Further to the above, I've noticed that previously OK razor files are now complaining about:-

    ":" is not valid at the start of a code block. Only identifiers, keywords, comments, "(" and "{" are valid. in both Visual Studio and in the Umbraco Edit Script File interface.

    This site has run for months, it appears this upgrade has disturbed parsing of Razor files.  Any clues to how to fix this would be greatly appreciated.

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    Oct 02, 2012 @ 18:47
    Craig100
    0

    Am I the only one this has happened to then?  If someone could help be fault find it, maybe I can get it working and let others know too.

    Craig

  • Craig100 1136 posts 2523 karma points c-trib
    Oct 30, 2012 @ 18:33
    Craig100
    0

    So, I had to re-install windows and rebuild my dev machine.  Same issue as before. Web Matrix 2 says it wants to upgrade my site to work on .net 2 (it's a .net 4 site anyway as it's Umbraco 4.7.2), now most macros won't run. 

    If I open the site in VS2010 and attempt a build, it croaks on the following macro with this error:

    ":" is not valid at the start of a code block.  Only identifiers, keywords, comments, "(" and "{" are valid. 

     

    @{
      //Check there are slider image pages loaded
      var theCount = @Model.Descendants("SliderImagePage").Count();
      if (theCount > 0) 
    {
            foreach (var theImagePage in Model.Descendants("SliderImagePage")) 
    {
               var theImage = theImagePage.Media("sliderImage","umbracoFile");
               if (theImagePage.IsFirst()) 
      {
                @: <div class="slide" style="background-image:url('@Html.Raw(theImage)');display:block;"></div>
                }
    else
    {
                @: <div class="slide" style="background-image:url('@Html.Raw(theImage)');display:none;"></div>
                }
              }    
         }
    else
    {
       @: No Picture Image pages set up
      }  
    }

    This is exactly the same code that is running on the live server and Umbraco itself has no problems with. However, I need to work on it locally so it must build and display ok. 

    Is it an issue with WebMatrix/VS2010 or is there a fault with the syntax. Look ok to me.

    Any advice would be greatly appreciated.

    Craig

Please Sign in or register to post replies

Write your reply to:

Draft