I am trying to build a project using latest version of Prism and Unity but, it gives below error. How to fix below error?
Assembly 'Microsoft.Practices.Prism.UnityExtensions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' uses 'Microsoft.Practices.Unity, Version=3.0.1208.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'Microsoft.Practices.Unity, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' c:\Prism4.1\Bin\Desktop\Microsoft.Practices.Prism.UnityExtensions.dll HelloWorld.Desktop
This is a problem between Unity and Prism.
Apparently, when the version of Prism for .NET 4.5 was built they were using a version of Unity signed with a version number of 3.0.1208.0. However, in the latest releases of Unity it seems that they reset that number back to 3.0.0.0, which is causing this error as the latest version of Unity has a lower version number that the previous one.
There is a thread in the CodePlex forums for Prism mentioning this with a couple of workarounds for it:
Prism 4.5 and Unity 3.0
Related
My .NET 5 application after nuget update is facing an error when I run the application.
TypeLoadException: Could not load type 'System.Web.UI.ParseChildrenAttribute' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
If you look in the documentation ParseChildrenAttribute Class Microsoft documentation the supported version is up to 4.8. You are using some packages or libraries that are dependent on this reference and that is why you can't upgrade to .Net 5.
Using VS2017, I've created a ClassLibrary (.NET Framework 4.6.2) in an empty solution. Then I've installed System.Net.Http 4.3.2 package there and used HttpClient class in a Class1 constructor.
Then I've created a ConsoleApp (.NET Framework 4.6.2), referenced ClassLibrary and instantiated Class1 in the Main method.
Now running ConsoleApp causes runtime exception:
Unhandled Exception: System.IO.FileNotFoundException: Could not load
file or assembly 'System.Net.Http, Version=4.1.1.1, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The
system cannot find the file specified. at
ClassLibrary1.Class1..ctor() at ConsoleApp1.Program.Main(String[]
args) in [...]
In detailed build log I see this message:
2> There was a conflict between "System.Net.Http, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" and
"System.Net.Http, Version=4.1.1.1, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
2> "System.Net.Http, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" was chosen because it was primary and
"System.Net.Http, Version=4.1.1.1, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" was not.
Let's suppose I can not remove reference to System.Net.Http from ConsoleApp, because I have this situation in a real project structure.
Playing with Specific Version parameter of System.Net.Http
reference did not help.
Specifying <bindingRedirect oldVersion="0.0.0.0-4.1.1.1"
newVersion="4.1.1.1" /> did not help
I've googled it and it is a popular problem, but I didn't find a clear explanation of what actually happens and how to fix such cases in general.
Could not load file or assembly System.Net.Http version 4.1.1.0
Could not load file or assembly 'System.Net.Http' or one of its dependencies
About conflicts:
What does .NET mean by 'primary' when choosing between conflict dll reference?
Found conflicts between different versions of the same dependent assembly that could not be resolved error
I wonder why you are choosing to use the NuGet package instead of using the Reference Manager to load in the appropriate assembly. By default in a lot of project templates VS includes System.Net.Http. If it is the case that you used the NuGet package explorer to install the assembly, then one of the two options should help out:
Remove the NuGet package and use the assigned version from the Reference Manager (look under Assemblies / Framework) though I am betting this is already selected.
In the Reference Manager un-select the assigned version of System.Net.Http and use the one that you installed with NuGet.
Personally I think option 1 is better unless you absolutely need something specific found only in the NuGet latest version.
The best and easiest way to fix this issue, is with a binding redirect, as said. But the versioning looks off.
Simply specify the oldVersion as 0.0.0.0-5.0.0.0, and newVersion as 4.1.1.0
Where 4.1.1.0 is your version, for example.
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.
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
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.