我有一個控制檯應用程序c#項目,依賴於NHibernate 3.3.2和ShapArch.NHibernate 2.0.4.628已經用NHibernate 3.3.1編譯(據我所知 - 我可能是錯的,但是當我創建了2.0.4 SharpArch項目時,它通過Nuget下載了NH 3.3.1)。在Visual Studio中顯示的dll版本不能反映引用的dll文件/產品版本
爲什麼Visual Studio在引用的dll是3.3.2.4000時顯示NHibernate是版本3.3.1.4000?所有引用的特定版本屬性都設置爲false。 SharpArch的版本出現在VS 2.0.0.0中,而不是文件/產品版本2.0.4。
在應用程序配置我:
<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>
該應用程序失敗,並加載:
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's 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's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
FileName=NHibernate, Version=3.3.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4
我甚至不知道爲什麼它試圖加載3.3.0.4000時尖銳架構已經與3.3.1編譯。
希望有人創建一個VS擴展,以顯示屬性列表中的文件版本。 –
現在,我將始終使用.net反射器,它始終向我顯示版本以及dll依賴的dll版本 – costa