Open roman-yagodin opened 3 years ago
DNN 9.8.0 is shipped with Microsoft.Extensions.DependencyInjection
assemblies of 2.1.1.0, while R7.Dnn.Extensions.EFCore - with 1.1.0.0 ones.
Removing Microsoft.Extensions.DependencyInjection.dll
and Microsoft.Extensions.DependencyInjection.Abstractions.dll
from installer fixes crash after install, but could cause further issues.
Installing R7.University 2.7.1 after that produces following error. Probably will require binding redirect:
Message:Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
StackTrace:
InnerMessage:Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
InnerStackTrace:
at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
at R7.Dnn.Extensions.EFCore.EFCoreDataContextBase..ctor()
at R7.Dnn.Extensions.EFCore.EFCoreDnnDataContextBase..ctor()
at R7.University.Data.UniversityDataContextFactory.Create()
at R7.Dnn.Extensions.Models.ModelContextBase.get_Context()
at R7.Dnn.Extensions.Models.ModelContextBase.Query[TEntity]()
at R7.University.Queries.FlatQuery`1.List()
at R7.University.Launchpad.DocumentTypesTable.GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, String search)
at R7.University.Launchpad.LaunchpadTableBase.DataBind(PortalModuleBase module, UniversityModelContext modelContext, String search)
at R7.University.Launchpad.ViewLaunchpad.BindTab(String tabName)
at R7.University.Launchpad.ViewLaunchpad.OnLoadComplete(Object sender, EventArgs e)
After adding binding redirect:
<dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="2.1.1.0" />
</dependentAssembly>
<dependentAssembly xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" />
<bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="2.1.1.0" />
</dependentAssembly>
Launchpad produces following error:
Message:Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.
StackTrace:
InnerMessage:Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'.
InnerStackTrace:
at Microsoft.EntityFrameworkCore.Internal.ServiceProviderCache.<>c__DisplayClass4_1.<GetOrAdd>b__2(Int64 k)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Microsoft.EntityFrameworkCore.DbContext.GetServiceProvider(DbContextOptions options)
at Microsoft.EntityFrameworkCore.DbContext..ctor(DbContextOptions options)
at R7.Dnn.Extensions.EFCore.EFCoreDataContextBase..ctor()
at R7.Dnn.Extensions.EFCore.EFCoreDnnDataContextBase..ctor()
at R7.University.Data.UniversityDataContextFactory.Create()
at R7.Dnn.Extensions.Models.ModelContextBase.get_Context()
at R7.Dnn.Extensions.Models.ModelContextBase.Query[TEntity]()
at R7.University.Queries.FlatQuery`1.List()
at R7.University.Launchpad.DocumentTypesTable.GetDataTable(PortalModuleBase module, UniversityModelContext modelContext, String search)
at R7.University.Launchpad.LaunchpadTableBase.DataBind(PortalModuleBase module, UniversityModelContext modelContext, String search)
at R7.University.Launchpad.ViewLaunchpad.BindTab(String tabName)
at R7.University.Launchpad.ViewLaunchpad.OnLoadComplete(Object sender, EventArgs e)
Installing 2sxc (e.g. 11.04.00) prior to R7.Dnn.Extensions.EFCore fixes the issue with R7.University due to proper binding redirects and moving required assemblies into bin/2sxc
dir. This (plus removing DependencyInjection assemblies) could be considered a quickfix.
Proper solution is to adopt assembly binding code from 2sxc manifest: 2sic_2SexyContent.dnn.txt
In the future releases, this approach could allow to loosen implicit 2sxc relationship.