Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Conclusion: the "success story" with RazorEngine and MVC 4

Conclusion: the "success story" with RazorEngine and MVC 4

Scheduled Pinned Locked Moved The Lounge
rubyasp-nethelpvisual-studiocom
21 Posts 8 Posters 3 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Marc Clifton

    And for the record, I: 1. git-cloned the RazorEngine repo 2. changed the System.Web.Razor reference from 3.0.0.0 to 2.0.0.0 (otherwise both were being referenced, 3.0 by RazorEngine and 2.0 by the MVC 4 framework) 3. compiled it 4. Added a reference to RazorEngine from the RazorEngine.core bin folder And lo-and-behold, I was able to use the RazorEngine to parse a cshtml into a string. One last note -- when I tried to use WebMail on the host provider, I got a security violation, requiring this fix:

    Sigh. I feel like I'm playing Whac-a-Mole. Whack one problem, and another surfaces. This should NOT be this hard! (Gee, I think I said the same thing about Ruby on Rails) So, a couple lessons learned: 1. Don't use NuGet package installer. Build the pieces from the source code directly. 2. Make sure all the System.Web.[crap] assembly references reference exactly the same dll's. Marc

    Imperative to Functional Programming Succinctly Higher Order Programming

    W Offline
    W Offline
    wout de zeeuw
    wrote on last edited by
    #2

    I thought nuget was to manage dll versions properly. Never used it myself though, because I'm a dinosaur ;P.

    Wout

    B 1 Reply Last reply
    0
    • M Marc Clifton

      And for the record, I: 1. git-cloned the RazorEngine repo 2. changed the System.Web.Razor reference from 3.0.0.0 to 2.0.0.0 (otherwise both were being referenced, 3.0 by RazorEngine and 2.0 by the MVC 4 framework) 3. compiled it 4. Added a reference to RazorEngine from the RazorEngine.core bin folder And lo-and-behold, I was able to use the RazorEngine to parse a cshtml into a string. One last note -- when I tried to use WebMail on the host provider, I got a security violation, requiring this fix:

      Sigh. I feel like I'm playing Whac-a-Mole. Whack one problem, and another surfaces. This should NOT be this hard! (Gee, I think I said the same thing about Ruby on Rails) So, a couple lessons learned: 1. Don't use NuGet package installer. Build the pieces from the source code directly. 2. Make sure all the System.Web.[crap] assembly references reference exactly the same dll's. Marc

      Imperative to Functional Programming Succinctly Higher Order Programming

      M Offline
      M Offline
      Mark_Wallace
      wrote on last edited by
      #3

      The moral of the story: Windows isn't the only product where you should wait until a new version has matured a bit.

      I wanna be a eunuchs developer! Pass me a bread knife!

      B M 2 Replies Last reply
      0
      • W wout de zeeuw

        I thought nuget was to manage dll versions properly. Never used it myself though, because I'm a dinosaur ;P.

        Wout

        B Offline
        B Offline
        Brady Kelly
        wrote on last edited by
        #4

        I've never had issue with NuGet, over a couple of years, except recently with EF 6. It adds a reference to EntityFramework.SqlServer, which is never used in any code, but nonetheless required. So as soon as you "Remove unused references", it vanishes in a loud puff of smoke, leaving you head scratching about what broke. But then again, I've never even come across this RazorEngine monster. :~

        No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde

        1 Reply Last reply
        0
        • M Marc Clifton

          And for the record, I: 1. git-cloned the RazorEngine repo 2. changed the System.Web.Razor reference from 3.0.0.0 to 2.0.0.0 (otherwise both were being referenced, 3.0 by RazorEngine and 2.0 by the MVC 4 framework) 3. compiled it 4. Added a reference to RazorEngine from the RazorEngine.core bin folder And lo-and-behold, I was able to use the RazorEngine to parse a cshtml into a string. One last note -- when I tried to use WebMail on the host provider, I got a security violation, requiring this fix:

          Sigh. I feel like I'm playing Whac-a-Mole. Whack one problem, and another surfaces. This should NOT be this hard! (Gee, I think I said the same thing about Ruby on Rails) So, a couple lessons learned: 1. Don't use NuGet package installer. Build the pieces from the source code directly. 2. Make sure all the System.Web.[crap] assembly references reference exactly the same dll's. Marc

          Imperative to Functional Programming Succinctly Higher Order Programming

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #5

          Wow. Well, the project I'm on started with MVC 4, Razor 2, and EF 5. All installed with NuGet with no problems. The updrades to MVC 5, Razor 3, and EF 6 went pretty smoothly, though a few manual steps were required for the upgrades to work properly. I never had to do any of the stuff you're going through.

          A guide to posting questions on CodeProject

          Click this: Asking questions is a skill. Seriously, do it.
          Dave Kreskowiak

          M 1 Reply Last reply
          0
          • M Mark_Wallace

            The moral of the story: Windows isn't the only product where you should wait until a new version has matured a bit.

            I wanna be a eunuchs developer! Pass me a bread knife!

            B Offline
            B Offline
            Brady Kelly
            wrote on last edited by
            #6

            I see the file date for RazorEngine 2.1 is 2011. New version? Mature I can see, quite mature. Maybe a bit long in the tooth though.

            No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde

            M 1 Reply Last reply
            0
            • M Mark_Wallace

              The moral of the story: Windows isn't the only product where you should wait until a new version has matured a bit.

              I wanna be a eunuchs developer! Pass me a bread knife!

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #7

              Mark_Wallace wrote:

              Windows isn't the only product where you should wait until a new version has matured a bit.

              Yeah, I've been waiting since I started using Windows 3.1 ;) However, it is MVC 4 (and there's 5 already out too.) So how long does this stuff need to sit in the casket and ferment? Marc

              Imperative to Functional Programming Succinctly Higher Order Programming

              L M 2 Replies Last reply
              0
              • D Dave Kreskowiak

                Wow. Well, the project I'm on started with MVC 4, Razor 2, and EF 5. All installed with NuGet with no problems. The updrades to MVC 5, Razor 3, and EF 6 went pretty smoothly, though a few manual steps were required for the upgrades to work properly. I never had to do any of the stuff you're going through.

                A guide to posting questions on CodeProject

                Click this: Asking questions is a skill. Seriously, do it.
                Dave Kreskowiak

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #8

                Dave Kreskowiak wrote:

                Well, the project I'm on started with MVC 4, Razor 2, and EF 5. All installed with NuGet with no problems.

                Agreed - I had no issues with the core components. But the minute I tried adding something on top, kaboom.

                Dave Kreskowiak wrote:

                The updrades to MVC 5, Razor 3, and EF 6 went pretty smoothly, though a few manual steps were required for the upgrades to work properly.

                I'm thinking of updating to MVC 5, but I might do that on a VM and see how it goes first. Marc

                Imperative to Functional Programming Succinctly Higher Order Programming

                B 1 Reply Last reply
                0
                • M Marc Clifton

                  Mark_Wallace wrote:

                  Windows isn't the only product where you should wait until a new version has matured a bit.

                  Yeah, I've been waiting since I started using Windows 3.1 ;) However, it is MVC 4 (and there's 5 already out too.) So how long does this stuff need to sit in the casket and ferment? Marc

                  Imperative to Functional Programming Succinctly Higher Order Programming

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #9

                  Quote:

                  However, it is MVC 4 (and there's 5 already out too.) So how long does this stuff need to sit in the casket and ferment?

                  Sir, 6 is also out. They are producing faster than letting a developer learn..:D

                  M 1 Reply Last reply
                  0
                  • L Lost User

                    Quote:

                    However, it is MVC 4 (and there's 5 already out too.) So how long does this stuff need to sit in the casket and ferment?

                    Sir, 6 is also out. They are producing faster than letting a developer learn..:D

                    M Offline
                    M Offline
                    Marc Clifton
                    wrote on last edited by
                    #10

                    Suraj Sahoo | Coding Passion wrote:

                    Sir, 6 is also out.

                    Good grief. Marc

                    Imperative to Functional Programming Succinctly Higher Order Programming

                    1 Reply Last reply
                    0
                    • B Brady Kelly

                      I see the file date for RazorEngine 2.1 is 2011. New version? Mature I can see, quite mature. Maybe a bit long in the tooth though.

                      No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde

                      M Offline
                      M Offline
                      Mark_Wallace
                      wrote on last edited by
                      #11

                      But still only 2.1, so still an "early" version. Going by MS' record, "mature" would be 2.3 or higher -- pretty much any major version of an MS product needs to get to at least the third service pack before most of the complaints are dealt with.

                      I wanna be a eunuchs developer! Pass me a bread knife!

                      1 Reply Last reply
                      0
                      • M Marc Clifton

                        Mark_Wallace wrote:

                        Windows isn't the only product where you should wait until a new version has matured a bit.

                        Yeah, I've been waiting since I started using Windows 3.1 ;) However, it is MVC 4 (and there's 5 already out too.) So how long does this stuff need to sit in the casket and ferment? Marc

                        Imperative to Functional Programming Succinctly Higher Order Programming

                        M Offline
                        M Offline
                        Mark_Wallace
                        wrote on last edited by
                        #12

                        Hanging around a long time just makes it dated. To mature it has to be improved with age.

                        I wanna be a eunuchs developer! Pass me a bread knife!

                        1 Reply Last reply
                        0
                        • M Marc Clifton

                          And for the record, I: 1. git-cloned the RazorEngine repo 2. changed the System.Web.Razor reference from 3.0.0.0 to 2.0.0.0 (otherwise both were being referenced, 3.0 by RazorEngine and 2.0 by the MVC 4 framework) 3. compiled it 4. Added a reference to RazorEngine from the RazorEngine.core bin folder And lo-and-behold, I was able to use the RazorEngine to parse a cshtml into a string. One last note -- when I tried to use WebMail on the host provider, I got a security violation, requiring this fix:

                          Sigh. I feel like I'm playing Whac-a-Mole. Whack one problem, and another surfaces. This should NOT be this hard! (Gee, I think I said the same thing about Ruby on Rails) So, a couple lessons learned: 1. Don't use NuGet package installer. Build the pieces from the source code directly. 2. Make sure all the System.Web.[crap] assembly references reference exactly the same dll's. Marc

                          Imperative to Functional Programming Succinctly Higher Order Programming

                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #13

                          Not sure what you are trying to do exactly, but whenever I run into a version conflict with the System.Web stuff, an assembly binding usually does the trick (an assembly binding basically says "whenever you see versions x-y if this DLL, use version z instead"). I agree, though, it is a bit like Whac-a-Mole. After installing a Windows update a week or two ago, many of my projects stopped working and required a modification to their assembly bindings (and/or removed/re-added references). I still have a project that inexplicably no longer has intellisense (compiles fine, but says everything is an error in the IDE). :doh:

                          Thou mewling ill-breeding pignut!

                          W M 2 Replies Last reply
                          0
                          • M Marc Clifton

                            Dave Kreskowiak wrote:

                            Well, the project I'm on started with MVC 4, Razor 2, and EF 5. All installed with NuGet with no problems.

                            Agreed - I had no issues with the core components. But the minute I tried adding something on top, kaboom.

                            Dave Kreskowiak wrote:

                            The updrades to MVC 5, Razor 3, and EF 6 went pretty smoothly, though a few manual steps were required for the upgrades to work properly.

                            I'm thinking of updating to MVC 5, but I might do that on a VM and see how it goes first. Marc

                            Imperative to Functional Programming Succinctly Higher Order Programming

                            B Offline
                            B Offline
                            Brady Kelly
                            wrote on last edited by
                            #14

                            Marc Clifton wrote:

                            But the minute I tried adding something on top, kaboom.

                            Is this not then a fault of the "something on top" rather than of MS, MVC, and Razor?

                            No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde

                            M 1 Reply Last reply
                            0
                            • A AspDotNetDev

                              Not sure what you are trying to do exactly, but whenever I run into a version conflict with the System.Web stuff, an assembly binding usually does the trick (an assembly binding basically says "whenever you see versions x-y if this DLL, use version z instead"). I agree, though, it is a bit like Whac-a-Mole. After installing a Windows update a week or two ago, many of my projects stopped working and required a modification to their assembly bindings (and/or removed/re-added references). I still have a project that inexplicably no longer has intellisense (compiles fine, but says everything is an error in the IDE). :doh:

                              Thou mewling ill-breeding pignut!

                              W Offline
                              W Offline
                              Worried Brown Eyes
                              wrote on last edited by
                              #15

                              AspDotNetDev wrote:

                              I still have a project that inexplicably no longer has intellisense (compiles fine, but says everything is an error in the IDE)

                              Do you have Resharper installed? I had this problem & found instructions to delete the _resharper (from memory, this may not be the exact name) folders. Unfortunately, I didn't appear to have these & it was a machine reboot that fixed it. Regards, Stewart

                              A 1 Reply Last reply
                              0
                              • A AspDotNetDev

                                Not sure what you are trying to do exactly, but whenever I run into a version conflict with the System.Web stuff, an assembly binding usually does the trick (an assembly binding basically says "whenever you see versions x-y if this DLL, use version z instead"). I agree, though, it is a bit like Whac-a-Mole. After installing a Windows update a week or two ago, many of my projects stopped working and required a modification to their assembly bindings (and/or removed/re-added references). I still have a project that inexplicably no longer has intellisense (compiles fine, but says everything is an error in the IDE). :doh:

                                Thou mewling ill-breeding pignut!

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #16

                                AspDotNetDev wrote:

                                an assembly binding usually does the trick

                                Agreed. Unfortunately there is no message other than a vague "two versions of the same assembly are being referenced", but of course the idiot that programmed that message didn't think to indicate which assembly. And that message only occurs under certain circumstances. Unfortunately again, the root cause, being a dependent assembly, makes it almost impossible to know which binding to make. Now that I think about it, I should have bound every assembly, mwahaha. Marc

                                Imperative to Functional Programming Succinctly Higher Order Programming

                                A 1 Reply Last reply
                                0
                                • B Brady Kelly

                                  Marc Clifton wrote:

                                  But the minute I tried adding something on top, kaboom.

                                  Is this not then a fault of the "something on top" rather than of MS, MVC, and Razor?

                                  No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde

                                  M Offline
                                  M Offline
                                  Marc Clifton
                                  wrote on last edited by
                                  #17

                                  Brady Kelly wrote:

                                  Is this not then a fault of the "something on top" rather than of MS, MVC, and Razor?

                                  Well, there is no specific thing to blame. It's a combination of factors -- DLL version hell, DLL dependency hell, package installers that will install the latest and greatest without checking if you've got the latest and greatest other stuff that it depends on, etc.etc.etc. Which of course, because there is no single point of failure to fix, means the issue doesn't get fixed. Marc

                                  Imperative to Functional Programming Succinctly Higher Order Programming

                                  B 1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    Brady Kelly wrote:

                                    Is this not then a fault of the "something on top" rather than of MS, MVC, and Razor?

                                    Well, there is no specific thing to blame. It's a combination of factors -- DLL version hell, DLL dependency hell, package installers that will install the latest and greatest without checking if you've got the latest and greatest other stuff that it depends on, etc.etc.etc. Which of course, because there is no single point of failure to fix, means the issue doesn't get fixed. Marc

                                    Imperative to Functional Programming Succinctly Higher Order Programming

                                    B Offline
                                    B Offline
                                    Brady Kelly
                                    wrote on last edited by
                                    #18

                                    Marc Clifton wrote:

                                    Which of course, because there is no single point of failure to fix, means the issue doesn't get fixed.

                                    Too true, in fact.

                                    No object is so beautiful that, under certain conditions, it will not look ugly. - Oscar Wilde

                                    1 Reply Last reply
                                    0
                                    • M Marc Clifton

                                      AspDotNetDev wrote:

                                      an assembly binding usually does the trick

                                      Agreed. Unfortunately there is no message other than a vague "two versions of the same assembly are being referenced", but of course the idiot that programmed that message didn't think to indicate which assembly. And that message only occurs under certain circumstances. Unfortunately again, the root cause, being a dependent assembly, makes it almost impossible to know which binding to make. Now that I think about it, I should have bound every assembly, mwahaha. Marc

                                      Imperative to Functional Programming Succinctly Higher Order Programming

                                      A Offline
                                      A Offline
                                      AspDotNetDev
                                      wrote on last edited by
                                      #19

                                      If you turn on detailed debug information, you will get more information about the affected assemblies.

                                      Thou mewling ill-breeding pignut!

                                      M 1 Reply Last reply
                                      0
                                      • W Worried Brown Eyes

                                        AspDotNetDev wrote:

                                        I still have a project that inexplicably no longer has intellisense (compiles fine, but says everything is an error in the IDE)

                                        Do you have Resharper installed? I had this problem & found instructions to delete the _resharper (from memory, this may not be the exact name) folders. Unfortunately, I didn't appear to have these & it was a machine reboot that fixed it. Regards, Stewart

                                        A Offline
                                        A Offline
                                        AspDotNetDev
                                        wrote on last edited by
                                        #20

                                        Nope, Resharper caused more problems than it solved, so I never installed it on my current VM.

                                        Thou mewling ill-breeding pignut!

                                        1 Reply Last reply
                                        0
                                        • A AspDotNetDev

                                          If you turn on detailed debug information, you will get more information about the affected assemblies.

                                          Thou mewling ill-breeding pignut!

                                          M Offline
                                          M Offline
                                          Marc Clifton
                                          wrote on last edited by
                                          #21

                                          AspDotNetDev wrote:

                                          If you turn on detailed debug information, you will get more information about the affected assemblies.

                                          Ah - I'll add that to my "toolchest" - I typically configure the build output to quiet or minimal or whatever the lowest setting is. Though, my particular problem was such that the build on my dev box reported no problems, but when I "deployed" onto the host server, I got a dependency error which was impossible to determine what the issue was because it's a hosted server rather than a machine I have full control over. Marc

                                          Imperative to Functional Programming Succinctly Higher Order Programming

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups