Dlls displayed in visual studio.Net not reflecting the reference versions of dll files / products

I have a C # console project that depends on NHibernate 3.3.2 and ShapArch.NHibernate 2.0.4.628, which was compiled with NHibernate 3.3.1 (as far as I know, I could be wrong, but when I created 2.0.4 the SharpArch project loads NH 3.3.1 via Nuget).

Why does Visual Studio show NHibernate as version 3.3.1.4000 when the referenced dll is 3.3.2.4000? The Specific Version property is set to false for all links. And the version for SharpArch appears in version 2.0.0.0 instead of 2.0.4, which is the file / version of the product.

In the application configuration, I have:

<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-3.3.1.4000" newVersion="3.3.2.4000" /> </dependentAssembly> </assemblyBinding> </runtime> 

The application does not load using:

 System.IO.FileLoadException was unhandled Message=Could not load file or assembly 'NHibernate, Version=3.3.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Source=MyApp.ResourcesGenerator FileName=NHibernate, Version=3.3.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 FusionLog="" StackTrace: at MyApp.ResourcesGenerator.Program.InitializeNHibernateSession() at SharpArch.NHibernate.NHibernateInitializer.InitializeNHibernateOnce(Action initMethod) in d:\Builds\SharpArch2\Solutions\SharpArch.NHibernate\NHibernateInitializer.cs:line 54 at MyApp.ResourcesGenerator.Program.Initialize() in C:\projects\tc\Trunk\Source_LibsUpgrade\Applications\PerformanceManagement\MyApp.ResourcesGenerator\Program.cs:line 149 at MyApp.ResourcesGenerator.Program.Main(String[] args) in C:\projects\tc\Trunk\Source_LibsUpgrade\Applications\PerformanceManagement\MyApp.ResourcesGenerator\Program.cs:line 31 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.IO.FileLoadException Message=Could not load file or assembly 'NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) FileName=NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 

I'm not even sure why it is trying to load 3.3.0.4000 when the sharp architecture was compiled with 3.3.1.

+6
source share
1 answer

NHibernate 3.3.2.GA has a file version 3.3.2.4000, but the build version is still 3.3.1.4000. This was done to update NHibernate without the need to redirect bindings. All subsequent NHibernate modifications for minor versions will also follow this pattern.

So, the solution for you is simply to remove the binding redirection.

The incomprehensible part here is that only versions of files and products are displayed in Windows Explorer, but Visual Studio only shows the version of the assembly.

+11
source

All Articles