SSIS Could not load file or assembly EntityFramework.
Applies to: Microsoft SQL Server 2022/2019/2017/2016 on Windows.
Date created: August 2, 2024.
Problem Description.
Trying execute a SQL Server Agent job that executes a SSIS (SQL Server
Integration Services) package the job failed. Examining the job history I found
the errors logged.
Date 8/2/2024 10:36:05 AM
Log Job History (DWH - Update Data)
Step ID 2
Server SQLInstancePOC
Job Name Update Data
Step Name Upload files
Duration 00:01:26
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: ETL_User. Microsoft (R) SQL Server Execute Package Utility
Version 13.0.5026.0 for 64-bit Copyright (C) 2016 Microsoft. All rights
reserved. Started: 10:36:05 AM Error: 2024-08-02 10:37:30.14 Code: 0xC0047062
Source Fuzzy Lookup - Levenshtein algorithm [26] Description:
System.IO.FileNotFoundException: Could not load file or assembly 'EntityFramework,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its
dependencies. The system cannot find the file specified. File name: 'EntityFramework,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' at
Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception
e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute() at
Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostPreExecute(IDTSManagedComponentWrapper100
wrapper) WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]
(DWORD) to 1. Note: There is some performance penalty associated with assembly
bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
End Error Error: 2024-08-02 10:37:30.22 Code: 0xC004701A Source: DFT
SSIS.Pipeline Description: Fuzzy Lookup - Levenshtein algorithm failed the
pre-execute phase and returned error code 0x80070002. End Error DTExec: The
package execution returned DTSER_FAILURE (1). Started: 10:36:05 AM Finished:
10:37:30 AM Elapsed: 85.141 seconds. The package execution failed. The step
failed.
Workaround/Solution.
As a workaround I found the required Entity Framework related assemblies
requested by the SSIS package on another server and proceeded to put them on a
folder on the local computer.
After that I proceeded to install those DLLs in the GAC using the gacutil.
gacutil -I G:\EF_SQL_Server\v4.0_6.0.0.0__b77a5c561934e089\EntityFramework.dll
gacutil -I G:\EF_SQL_Server\v4.0_6.0.0.0__b77a5c561934e089\EntityFramework.SqlServer.dll
After this workaround the SQL Server Agent job executed the SSIS package
successfully.