when i decompilation assembly Microsoft.AspNet.Identity.Core in my project
I got stuck seeing string
#region Assembly Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
d:\Projects\tb\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll
#endregion
In first sting specified version 2.0.0.0
In second string specified version 2.2.1
Which version I use? how could this happen?
2.2.1 is a version of NuGet package Microsoft.AspNet.Identity.Core that contains Microsoft.AspNet.Identity.Core.dll.
2.0.0 is a version of Microsoft.AspNet.Identity.Core.dll.
Related
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 Visual Studio 2010 and .NET 4.0. When I try to use FSharp.Data.dll 2.0.9 in my C# project, it gives the warning:
The primary reference "FSharp.Data" could not be resolved because it
has an indirect dependency on the .NET Framework assembly
"FSharp.Core, Version=4.3.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which has a higher version "4.3.0.0"
than the version "4.0.0.0" in the current target framework.
Update:
I downloaded and added FSharp.Core version 4.3.0.0 dll to the project reference. It now has one more error message:
The primary reference "FSharp.Core, Version=4.3.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" could not
be resolved because it has a higher version "4.3.0.0" than exists in
the current target framework. The version found in the current target
framework is "4.0.0.0".
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 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
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.