Trying to Upgrade froM MVC3 to MVC4, all ok bar one component which is still referencing 3.0.0.0 - asp.net-mvc

I have upgraded my MVC3 application using the Nuget UpgradeFromMvc3ToMvc4 which has worked fine, except for one component. I did uninstall the V3 of this "MvcSiteMapProvider" component before upgrading, and then installed "MvcSiteMap Core V4" after the MVC4 upgrade.
Ther error I get is:
Error 41 Assembly 'MvcSiteMapProvider, Version=4.6.18.0,
Culture=neutral, PublicKeyToken=1923abe4657913cc' uses 'System.Web.Mvc,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which
has a higher version than referenced assembly 'System.Web.Mvc,
Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
d:\..\MvcSiteMapProvider.MVC4.Core.4.6.18\lib\net45
\MvcSiteMapProvider.dll
There is no reference to 3.0.0.0 in my solution. I have done a "find" in "all files". So am confused.
Any help appreciated. Thanks.

Drop refference to System.Web.MVC and readd it.
Sometimes this just happends.

Related

Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

I have an ASP.Net MVC Entity Framework project which is working fine on local machine. But when I upload it to Azure Web App, I get following error:
Could not load file or assembly 'System.Web.WebPages.Razor,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies.
Full screenshot
The version I have referenced in project is 3.0.0.0 and same is present in bin folder. I have cleaned and rebuild project several times and also deleted obj and bin directories but in vain.
Why is it trying to find version 2.0.0.0 when I have referenced 3.0.0.0?

Update assembly version MvcSportStore

I am trying to follow an example in a book about MVC but i get an error when trying to build the project.
This is the error:
Error 2 Assembly 'SportsStore.WebUI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Users\XXX\Documents\Visual Studio 2013\Projects\Sport\SportsStore.WebUI\bin\SportsStore.WebUI.dll SportsStore.UnitTests
It seems to me that I am running two different versions of the same assembly and I should probably update or "downdate" one of them? Can someone suggest which file and how to change it?
Thank you
The answer might be a little too late but hopefully it helps someone else. I had a similar issue and I resolved it by removing the lower version and running the command below inside of package manager console
install-package Microsoft.AspNet.Mvc -version 5.2.0

Exception after installing Microsoft ASP.NET MVC Fixed DisplayModes package

After installing ASP.NET MVC Fixed DisplayModes package, I get the following error when building my MVC4 website:
ASPNETCOMPILER : error ASPRUNTIME: [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\Muhammad\AppData\Local\Temp\Temporary ASP.NET Files\temp\8b747d93\6b897626\assembly\dl3\00bbd837\ffb45330_28d7ce01\System.Web.WebPages.Razor.dll'.
I searched the project configuration and references for and mention of version 2.0 of System.Web.WebPages.Razor and removed it with no success.
I know this a old post, but try this:
http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

EPPlus The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)

Hi I am using EPPlus to create excel in c# 2.0. I have added the reference of "EPPlus.dll" and also added
using OfficeOpenXML;
but when i am trying to run the solution its giving the follwoing error.
Error:
The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?)
Warning 1:
The primary reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" or retarget your application to a framework version which contains "WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
Warning 2:
The primary reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the framework assembly "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v2.0". To resolve this problem, either remove the reference "EPPlus, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".
Thanks in advance..
This solved the problem for me :
Errors on EPPlus
just change the target of your proyect from ".Net 4.0 Client Profile" to just ".Net 4.0"
Rolling back to a prior version worked for me.
This could happen when you migrate project from one computer to another. The solution in my case was
Open the project/website in Visual Studio
Save it as solution (if it is website) - important
Go to Nuget for this solution. It will give you an error that some plugs are installed incorrect and needs to be restored. Click restore button but it might actually not work
Check EPPLUS in the nuget, select properties and uncheck from solution to uninstall it.
Reinstall it again. This should fix it.
Even,I had this type of error in past.So,what you have to do to solve this error.
Firstly, you have check to EPPLUS.dll in bin folder.If you will not see in your bin folder than add it .
secondly,if you see than ,right click on reference folder/add reference/click on browse/add EPPLUS.dll
If you don't have that download from below link:enter link description here
The error was told that the epplus has an indirect reference to the windowbase 3.0 which do not included in .net framework 2.0 then i manage to find that dll located in
"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll". thank to this question WindowsBase Version 3.0.0.0 in Global Assembly Cache
So i just referenced that dll to my project and the error was gone. this cloud be help.

Could not load assembly WebPages.Deployment version 2 at host?

I have a ASP.NET MVC 2 website (VS2010) that I have upgraded to ASP.NET MVC 3 (VS2012) and this works fin on local IIS7 but when publishing it I get this exception on host :
Could not load file or assembly 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
After some seartch I found this that states that I should set CopyLocal on some of the references(inlcuding the System.Web.WebPages) and also use the publish tool in VS2012, but this generated the following exception?
Could not load file or assembly 'System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
And I canĀ“t find any Deployment dll to set copyLocal?
How could I solve this?
Have a read of http://joel.net/getting-asp.net-mvc-3-working-on-discountasp.net
You need to add a reference to System.Web.WebPages.Deployment and set that also to CopyLocal.

Resources