2

We have ASP.NET WebSite and it refers project (dll) which refer EntityFramework dll. We have added EntityFramework.dll and EntityFramework.SqlServer.dll reference to bin folder manually(not through Nuget). We are using Octopus to deploy our websites. While deploying we dont have EntityFramework.SqlServer dll in bin folder. I have gone through various answers but couldn't get it. Anybody know the answer on the same? I have tried publishing through VS and I see SqlServer of EF in bin folder. Surprisingly we dont have any reference entry in our web.config for EF dll version.

Not sure about adding below code which some of them suggested -

 var ensureDLLIsCopied = System.Data.Entity.SqlServer.SqlProviderServices.Instance;

Error Message-

ERROR occurred in LockAutomationNotification.NotifyEmail
System.Data.Entity.Core.MetadataException: Schema specified is not valid. Errors: 
OLIEDataModel.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See 
RBT
  • 24,161
  • 21
  • 159
  • 240
Punit
  • 1,347
  • 3
  • 20
  • 39
  • "We have added EntityFramework.dll and EntityFramework.SqlServer.dll reference to bin folder manually(not through Nuget)" why? I suspect this is the problem. Why not just use Nuget? Octopus deploys nuget packages. If the package for your website does not contain the EF dll then it won't get deployed. – Ben Robinson Dec 18 '14 at 13:42
  • Have you checked that the web.config contains the required settings? – ErikEJ Dec 18 '14 at 14:04
  • Related posts - [EntityFramework.SqlServer.dll not is getting added to the published folder only when I publish in RELEASE mode](https://stackoverflow.com/q/25433298/465053) & [No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'](https://stackoverflow.com/q/18455747/465053) – RBT Jul 23 '21 at 11:11

1 Answers1

0

Answer to your first question is here. It is happening as EntityFramework.SqlServer.dll is referenced internally by EntityFramework.dll but not your project code.

The new error you're getting is because of your missing configurations. Please add below settings in web.config file of your website:

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
<entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
RBT
  • 24,161
  • 21
  • 159
  • 240