Could not load file or assembly 'System.Web.Helpers' or one of its dependencies.
Hi everyone,
I was working on a local website I am building when I randomly got this error message when refreshing the website, and I don't know what's went wrong.
Could not load file or assembly 'System.Web.Helpers' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I added a new empty .cshtml file to the MacroScripts folder in Visual Studio, copied in some code that works as a site navigation, and then when I refreshed the page in Chrome I encountered that error message.
I've also noticed that the very top line of code in my master template is showing a blue line under it. It says the master file doesn't exist, but I've triple checked and it's definitely correct.
If anybody can help solve this problem for me it would be greatly appreciated.
I also apologise in advance if this is a rookie error and very simple to fix.
I've checked the file you mentioned and there is no mention of System.Web.Helpers anywhere in there.
I created a razor macro in the MacroScripts folder that would filter through pages and put them in a list, like a navigation. I've used the exact same method and exact same code on multiple projects before and never encountered this problem. I've since deleted the razor file to see if that would fix it but it didn't.
I'm using 6.1.6. I've not had any of these problems before because all other web projects were built on my desktop PC at home which has older .NET framework (I think it's 3 or 3.5). Whereas this project is being built on my newer laptop (I'm away from home at the moment) and the framework on it is 4.5.
Is it possible to change the framework to 3 or 3.5 to stop this issue. Or is this a poor method?
Hmm, I think you are in a bit of pickle with upgrading to MVC5, you will need to go back to MVC4 for it to work with Umbraco v6.1.6, do you have a backup?
I don't Jeavon but not to worry the website was in the very early stages of development so it's not a problem. I'm more worried about where this leaves me going forward as I'm unsure how to get past this issue.
Ok, this explains it a little more. Visual Studio 2015 is not compatible with MVC v4 so it will always start a project with MVC v5 but as I said before the first version of Umbraco to support MVC v5 is v7.2.2...
Could not load file or assembly 'System.Web.Helpers' or one of its dependencies.
Hi everyone,
I was working on a local website I am building when I randomly got this error message when refreshing the website, and I don't know what's went wrong.
I added a new empty .cshtml file to the MacroScripts folder in Visual Studio, copied in some code that works as a site navigation, and then when I refreshed the page in Chrome I encountered that error message.
I've also noticed that the very top line of code in my master template is showing a blue line under it. It says the master file doesn't exist, but I've triple checked and it's definitely correct.
If anybody can help solve this problem for me it would be greatly appreciated.
I also apologise in advance if this is a rookie error and very simple to fix.
Hi Jedd,
Did you upgrade Umbraco or MVC?
It's likely that you have System.Web.Helpers in the namespaces element in /Views/Web.Config that should be removed.
Jeavon
Hi Jeavon,
Thanks for responding.
I haven't upgraded Umbraco and I'm using WebForms. Everything was working fine until I added a new Razor file, then the error message occurred.
Any other ideas?
Cheers, Jedd
Hi Jedd,
Did you check the /Views/Web.config?
Jeavon
When you say WebForms/Razor files what are you creating and where?
Jeavon,
I've checked the file you mentioned and there is no mention of System.Web.Helpers anywhere in there.
I created a razor macro in the MacroScripts folder that would filter through pages and put them in a list, like a navigation. I've used the exact same method and exact same code on multiple projects before and never encountered this problem. I've since deleted the razor file to see if that would fix it but it didn't.
Thanks for your continued help, Jedd
May have found the issue here Jeavon...
Now can I be a nuisance and ask if you know how to go about fixing this?
Thanks again, Jedd
Indeed, your Visual Studio solution needs to target .Net 4.5 instead of 4.0
Also I would recommend you look at using MacroPartials instead of MacroScripts as these are depreciated now.
And how would I go about about pointing it to 4.5 instead of 4? I've never done anything like that before so sorry for the multiple questions.
I'll take a look at MacroPartials, thanks for the advice.
Jedd
Right click on the project and choose properties then change the Target Framework, should be something like the below:
Thanks Jeavon.
I made that change and I was thrown these errors.
Am I causing myself a lot of hassle by refusing to upgrade to Umbraco 7? Or is that not involved in these issue here?
Thanks,
Jedd
What version of Umbraco are you using?
It seems that you are trying to use MVC 5 for that you will need Umbraco v7.2.2+ but maybe that's not where you started out?
I'm using 6.1.6. I've not had any of these problems before because all other web projects were built on my desktop PC at home which has older .NET framework (I think it's 3 or 3.5). Whereas this project is being built on my newer laptop (I'm away from home at the moment) and the framework on it is 4.5.
Is it possible to change the framework to 3 or 3.5 to stop this issue. Or is this a poor method?
Hmm, I think you are in a bit of pickle with upgrading to MVC5, you will need to go back to MVC4 for it to work with Umbraco v6.1.6, do you have a backup?
I don't Jeavon but not to worry the website was in the very early stages of development so it's not a problem. I'm more worried about where this leaves me going forward as I'm unsure how to get past this issue.
Ok good, what version of Visual Studio are you using?
I am using Microsoft Visual Studio Express 2015 For Web
Ok, this explains it a little more. Visual Studio 2015 is not compatible with MVC v4 so it will always start a project with MVC v5 but as I said before the first version of Umbraco to support MVC v5 is v7.2.2...
I'm using the same version of Visual Studio and Umbraco on my desktop at home and I didn't encounter this problem when using my razor macros?
You can open a MVC4 project in VS2015 but you will get intellisense issues and you cannot create a MVC4 project in VS2015.
I think you really should start with the latest Umbraco v7.2.8 anyhow, what's holding you back?
Hey Jeavon,
I fixed the problem by upgrading to v6.2.5 and everything is working fine. Thanks for all of your help.
-Jedd
Great, glad you got it working! Hope you feel you can move onto using v7 soon!
is working on a reply...