A Microsoft platform for building enterprise-level data integration and data transformations solutions.
Hi Sahar,
The error you’re seeing (Could not load file or assembly MongoDB.Driver.Legacy) is happening because the legacy MongoDB driver is no longer included or supported in the newer MongoDB C# driver versions. Starting with driver 2.12+, only the unified MongoDB.Driver API is maintained, and MongoDB.Driver.Legacy has been deprecated.
A few steps that should resolve the issue:
- Remove Legacy References: Update your SSIS Script Component to remove any references to MongoDB.Driver.Legacy. Replace old API calls (MongoServer, MongoDatabase) with the modern equivalents (MongoClient, IMongoDatabase).
- Update Driver Packages: Use the latest MongoDB C# driver (2.19 or higher is recommended). Make sure both MongoDB.Driver and MongoDB.Bson assemblies are deployed with SSIS.
- Target Framework: The MongoDB driver officially supports .NET Framework 4.7.2 and above. Upgrading your Script Component project from 4.7 to 4.7.2 or 4.8 will help avoid binding/runtime issues.
- Deployment in SSIS: Ensure the correct assemblies are copied to the SSIS runtime environment (either in the GAC or alongside the package).
Hope this helps!
Thanks,
Lakshmi.