I have a old module in DotNetNuke. I used EF 5 in my project:
I added module to DotNetNuke and it worked properly. But when I add new module that requierd to EF 6 my module gives me an error:
Could not load file or assembly 'EntityFramework, Version=5.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference.
When installing this new module EntityFramework 6 dll file will be replaced with old version (Version=5.0.0.0) file and this causes old module doesn't work.
I read many post for solving this problem but I can't find a way for this issue.
It would be very helpful if someone could explain solution for this problem.
You can add this to your web.config
<configuration>
<runtime>
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<codeBase version="6.0.0.0" href="bin/EntityFramework-6.1.3/EntityFramework.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="EntityFramework.SqlServer" publicKeyToken="b77a5c561934e089" culture="neutral" />
<codeBase version="6.0.0.0" href="bin/EntityFramework-6.1.3/EntityFramework.SqlServer.dll" />
</dependentAssembly>
</runtime>
</configuration>
You have to add a folder called EntityFramework-6.1.3 into bin folder then add two follow dll to that
1-EntityFramework.dll
2-EntityFramework.SqlServer.dll
You can add this to web.config
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.1.3.0" newVersion="6.1.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Related
My solution has many projects, I want to check all of the *.config projects, to be sure if Microsoft.Extensions.DependencyInjection packages are in the version of 6.0.0.0 in all projects.
* But not from NuGet PackageManager Solution
I want to search for
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
As we can see, there are some white spaces or Tabs before <assemblyIdentity> and <bindingRedirect>.
How can I search all these 3 lines in the whole solution no matter of tabs or whitespaces before and after them in VS Code ?
ForExample if I search for
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
then the result could also be:
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
I can connect to my Postgresql database just fine (I generated the .edmx this way in the first place), but I can't generate a database from the .edmx.
The error indicates that no provider with the invariant name 'Npgsql' has been found, and that the entityFramework section of Web.config should be checked for it, but as far as I can tell it's here.
This is an ASP MVC5 application, here's the Web.config:
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="pgArcher" connectionString="Host=localhost;Database=Archerie;user=postgres;password=***" providerName="Npgsql" />
<add name="ArcherieEntities" connectionString="metadata=res://*/ArcherieEDM.csdl|res://*/ArcherieEDM.ssdl|res://*/ArcherieEDM.msl;provider=Npgsql;provider connection string="PORT=5432;TIMEOUT=15;POOLING=True;MINPOOLSIZE=1;MAXPOOLSIZE=20;COMMANDTIMEOUT=20;COMPATIBLE=2.2.5.0;HOST=localhost;DATABASE=Archerie;USER ID=postgres;PASSWORD=***"" providerName="System.Data.EntityClient" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.Cookies" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
<DbProviderFactories>
<add name="Npgsql - .Net Data Provider for PostgreSQL" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Version=2.2.5.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
<add name="dotConnect for PostgreSQL" invariant="Devart.Data.PostgreSql" description="Devart dotConnect for PostgreSQL" type="Devart.Data.PostgreSql.PgSqlProviderFactory, Devart.Data.PostgreSql, Version= 7.3.422.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
</DbProviderFactories>
</system.data>
<entityFramework>
<providers>
<provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=2.2.5.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
</providers>
</entityFramework>
</configuration>
Make sure you installed Npgsql and Npgsql.EntityFramework in the
project (seems to be obvious, but I've seen some cases when people
report errors like yours and just installed these packages in the
"Repository" project).
Npgsql and Mono.Security must be registered in GAC (check the version
you are using).
And at least, add the assembly binding for Npgsql as well:
<dependentAssembly>
<assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.5.0" newVersion="2.2.5.0" />
</dependentAssembly>
I have the following XML in my web config and in release mode I need to remove dependentAssembly section depending on the name attribute of its child : assemblyIdentity. I tried the answer here:xdt transform locator that matches subnode content but no luck.
My web.config is something like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.QualityTools.Resource" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<codeBase version="10.0.0.0" href="file:///c:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I have tried the following in my web.release.config to select the second dependentAssembly element for deletion based on the child element but no success.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" >
<dependentAssembly>
<!-- Attempt 1 -->
<assemblyIdentity xdt:Transform="RemoveAll"
xdt:Locator="Condition(#name='Microsoft.VisualStudio.QualityTools.Resource')"/>
</dependentAssembly>
</assemblyBinding>
<!-- Attempt 2 -->
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Remove"
xdt:Locator="Condition(assemblyIdentity/#name='Microsoft.VisualStudio.QualityTools.Resource')">
</dependentAssembly>
</assemblyBinding>
</runtime>
This code works for me.
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly xdt:Transform="Replace" xdt:Locator="Condition(./_defaultNamespace:assemblyIdentity/#name='System.Web.Mvc')">
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
All credit to #Thommy's stackoverflow answer to this post.
Any solution to this:
Assembly 'DomainModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
DomainModel\bin\Debug\DomainModel.dll
I have re-added the reference that points to mvc2, and whatmore is required ? Still this error.
ThankYou!
You need to add an assembly binding redirection section to your web.config file:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I'm using Unit-2.5.5.10112. How can I use also NBehave, if it has dependency on an older version of NUnit?
Should I ignore NBehave?
You can get NBehave 0.4.5 to use NUnit 2.5.5.10112 by doing the following:
First, create an NBehave-Console.exe.config containing the following:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework"
culture="neutral"
publicKeyToken="96d09a1eb7f44a77" />
<bindingRedirect oldVersion="2.5.2.9222" newVersion="2.5.5.10112" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
This tells the CLR loader that when NBehave-Console.exe looks for 2.5.2.9222 of nunit.framework, it should use 2.5.5.10112 instead.
Second, put nunit.framework.dll version 2.5.5.10112 in the C:\Program Files\NBehave\0.4.5.183 directory, replacing the older version.