Strange MVC Referencing Issue - c#

I have an MVC solution that was 3.0.0.0 but I'm upgrading it to 4.0.0.1. I've upgraded the System.Web.Mvc reference (in the reference folder) and it's dependencies, e.g. updated System.Web.WebPages from 1 to 2.
When I build the project it builds without issue, however when I run the project I get the following error:
Compiler Error Message: CS1705: Assembly 'MobileScanner, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
P.S. Using VS2010, and .Net 4.0

Thanks for your help but I fixed it.
The issue was that there were still references to MVC 3 and some of it's (old) dependencies (System.Web.Razor) in the root web.config and then again in the Views/web.config... once updated it worked a treat.

Related

The type 'MarshalByRefObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0

I'm trying to make a C# Console Application using .NetCore on "Visual Studio 2017" for the sake of running it on CentOS 7, what seems to be the issue is that apparently the .NetCore doesn't have some of the Classes that's inside the .Net Framework, or that's what I think the problem is.
So I've tried adding a reference to assembly mscorlib but that just made the errors even more..
Error CS0433 The type 'StringBuilder' exists in both 'mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and
'System.Runtime, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a'
Any idea how can I solve this issue?
Thanks.
.NetCore Console Application using Visual Studio 2017
MarshalByRefObject is not part of .NetCore so you should not use it.
Scroll to comments and you will find info and link about replacement.
https://blogs.msdn.microsoft.com/dotnet/2016/05/27/making-it-easier-to-port-to-net-core/

I get error on build that mvc assembly version postal is using is higher than referenced by my project. How do I resolve this?

I am using mvc 4 asp.net.
I have used postal.dll package from NuGet to send emails from my application.
But I get error on build that mvc assembly version postal is using is higher than referenced by my project. How do I resolve this? please help
I am using Visual studio 2012 mvc4
Thanks
Error:
Error 1 Assembly 'Postal, Version=0.9.2.0, Culture=neutral, PublicKeyToken=45719375b8b4d528' 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=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Users\xxxx\Documents\Visual Studio 2012\Projects\MyProject\packages\postal.0.9.2\lib\net40\Postal.dll MyProject
What your message is telling you is that Postal, Version=0.9.2.0, works with version System.Web.Mvc, Version=5.1.0.0, but you gave it System.Web.Mvc, Version=4.0.0.0 so it broke.
If you have two different assembly versions you might want to do binding redirect
<bindingRedirect
oldVersion="existing assembly version"
newVersion="new assembly version"/>
Other option would be to use System.Web.Mvc, Version=5.1.0.0 across your solution.
You could try to use an older version of Postal, assuming it satisfies your requirements.
Install-Package postal -Version 0.9.0

Stuck in ASP.NET MVC DLL HELL, Razor Assembly issue

I'm currently dealing with a problem on a ASP.NET MVC4 Application, I did a change of .NET Framework (from 4.5 to 4 then to 4.5 again) and it updated my NuGet packages so my Web.config is all messed up and i can't get rid of those errors that the YSOD shows me. Can you explain me a bit what can i do to correct those errors ?
Here's the error i get.
[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:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files\root\5ccfcdb0\4d5a6f51\assembly\dl3\5f700272\1350df4e_ebe9ce01\System.Web.WebPages.Razor.dll'.
Okay i solved my problem by myself.
I updated manually in the Web.config (from the Views Folder) the configuration to Version=3.0.0.0 and the version of the MvcWebRazorHostFactory (same file) to Version=5.0.0.0

Won't compile after installing: Mcv.Mailer version 1.0 uses Mvc version 4.0, which has higher version than referenced assembly Mvc version 3.0

I installed the nuget package for MvcMailer, found here. Although it didn't (as it says in the tutorial it will) add smtp configuration to web.config, I found the correct smtp configuration here.
I'm using MVC4 in VS2010.
When I compile, I get the following error in the the error list:
Error 1 Assembly 'Mvc.Mailer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' 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' c:\Users\Home\Desktop\MVCMusicStore - Copy\packages\MvcMailer.4.0\lib\40\Mvc.Mailer.dll MVCMusicStore
I also get the following warning:
Warning 2 Found conflicts between different versions of the same dependent assembly. MVCMusicStore
I removed the MvcMailer reference and added it again, but it didn't resolve the issue.
Help would be much appreciated.
I'm using Mvc 4, and was installing MvcMailer via the package manager with the following:
install-package MvcMailer
Because I'm using Mvc 4, the following should be used:
install-package MvcMailer3
This has resolved the issue.

what is the meaning of this error when i run my project

i got this error in c#
'Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
uses 'MySql.Data, Version=6.3.5.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d' which has a higher version
than referenced assembly 'MySql.Data, Version=6.2.3.0,
Culture=neutral, PublicKeyToken=c5687fc88969c44d'
what is the meaning of the error.
The version of the Assembly you are refreencing is wrong, try re add the reference to the assembly by removing and readding
It seems you have a AssemblyName mismatch
One of your referenced assembly use MySql.Data version 6.3.5.0 and you also use MySql.Data but the version 6.2.3.0. (Compiler Error CS1705)
Change the referenced assembly version of MySql.Data to 6.3.5.0

Categories