Reputation: 4918
Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
I am getting the above error when a run a project.
I have read a few posts on this about downloading a package from nuget but my problem is, is this project is downloaded from our source control and it seems to work on all other machines straight off. On this new machine it does not. Ideally I don't want to go messing with the project and checking something into the source control that will break it on other machines.
The project its self is an old classic asp project with a few .net bits both webforms and a little bit of razor, previously it's been run in VS 2012/2015 and now this new machine has VS 2017. I don't know if this is relevant so my question is:
Is there anything within the actual "environment" that could be missing rather than within the actual sln/project?
Upvotes: 1
Views: 3440
Reputation: 21
I had a similar problem. My code worked fine on my local PC, fine on Dev, but on the UAT box I got this same error.
For me the problem was I had the wrong combination of dll versions installed from nuget. I had the System.Web.MVC v4 and System.Web.Pages v3 (which is for MVC 5).
My guess is this worked ok locally and in Dev because MVC had been installed and it could find the correct version of the dlls in the GAC.
Using System.Web.Mvc v5 fixed the issue for me
Upvotes: 1