Are you often encountering errors like “could not load file or assembly 'Microsoft.SQLServer.ManagedDTS, Version=22.214.171.124, Culture=neutral, PublicKeyToken=xxxxxx' or one of its dependencies.” when executing SQL scripts? Well you’ve come to the right place!
This guide will provide the necessary steps to fix this issue in your system. We have a simple yet comprehensive step-by-step solution, a troubleshooting guide, and some FAQs that may help you with your resolution.
Step-by-Step: Fixing the Could Not Load File or Assembly 'Microsoft.SQLServer.ManagedDTS' Error
Check the Build Target: The most common cause of the 'Microsoft.SQLServer.ManagedDTS' error is mismatched .NET framework and build target versions. Make sure that your project references are updated to the correct .net framework and build target versions.
Set the SQLSERVER.ManagedDTS Version Number: Make sure that the version number of Microsoft.SQLServer.ManagedDTS specified in your project is the same as the version number of the installed version.
Update the Application Pool: If you are running your application in IIS, make sure to update the application pool pipeline mode to match the current version of .NET framework installed in your system and set the ‘Enable 32-Bit Applications’ to ‘true’.
Check the App.config File: Check the app.config file to make sure that all dependent assembly versions referenced in the app.config file match the versions of the assemblies being deployed.
Try Reinstalling the SqlServer Packages: If all the above steps fail, then try reinstalling the Microsoft.SQLserver.managedDTS and the Microsoft.SQLserver.managedDTS.runtime packages from NuGet
- List all the Version numbers of SQL Server you have.
- Check the Global Assembly Cache and determine whether the required version is present there.
- Check the web.config, app.config or machine.config file in your solution to make sure the same version is being used in the project
- Make changes to the versions in the web.config, app.config or machine.config file, to match the one installed on the server
- Try reinstallation of Microsoft.SQLserver.managedDTS and the Microsoft.SQLserver.managedDTS.runtime packages from NuGet
- Make sure jobs running in the server are using the same version
What is Microsoft.SQLServer.ManagedDTS?
Microsoft.SQLServer.ManagedDTS is a .net assembly related to Microsoft SQL Server, which can be used to programmatically interface with the SQL Server components. Microsoft.SQLServer.ManagedDTS is the namespace containing the API that can be used to access the analytics and transformation services.
What is the cause of 'Microsoft.SQLServer.ManagedDTS' error?
The 'Microsoft.SQLServer.ManagedDTS' error is generally caused when the version of .NET framework used in the project is not the same as the version of the assembly installed in the server.
How can this error be fixed?
To fix this error, you should check the Build target, set the SQLSERVER.ManagedDTS Version Number, update the application pool, check the App.config file, and try reinstalling the SqlServer Packages.
What do you mean by Setting the SQLSERVER.ManagedDTS Version Number?
Setting the SQLSERVER.ManagedDTS Version Number means to make sure that the version number of Microsoft.SQLServer.ManagedDTS mentioned in your project is the same as the version number of the installed version.
What is Global Assembly Cache?
Global Assembly Cache (GAC) is the repository of globally available assemblies in the .NET framework. It stores assemblies specifically designated to be shared over multiple applications on the same computer.