My virtual machines are my playground and I do install/uninstall a lot of stuff there (of course related to SQL Server learning). When things break, I get to learn something new. In this blog we would talk about how to troubleshoot and fix Could not load file or assembly error. This particular error can come in many flavors. Here is another form of the same error.
Could not load file or assembly ‘Microsoft.SqlServer.BatchParser, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91’ or one of its dependencies. The system cannot find the file specified
WORKAROUND/SOLUTION
You need to notice few things in the error message. I have shown the values as per the error message
- Assembly Name: Microsoft.SqlServer.BatchParser
- Version: 11.0.0.0
- Error Message: The system cannot find the file specified
If you check C:\WINDOWS\ASSEMBLY folder, you would see them like below.
Here is the version table:
SQL Server Version | Assembly Version Number |
SQL Server 2005 | 9.0.0.0 |
SQL Server 2008 | 10.0.0.0 |
SQL Server 2008 R2 | 10.0.0.0 |
SQL Server 2012 | 11.0.0.0 |
SQL Server 2014 | 12.0.0.0 |
SQL Server 2016 | 13.0.0.0 |
SQL Server 2017 | 14.0.0.0 |
Now, read the error message again and it would start making sense. We can see that 11.0.0.0 is missing from assembly folder. All we need is to install the right version of SMO (Shared Management Objects) and SQLCLR from feature pack. You can refer below article to know more about feature pack. Since 11.0.0.0 is missing, we need SQL 2012 version of the feature pack.
SQL SERVER – How to Download SQL Server Native Client?
In the article, I talked about Native Client but for current error, we need to download these files:
- ENU\x64\SQLSysClrTypes.msi for the X64 version
- ENU\x86\SQLSysClrTypes.msi for the X86 version
- ENU\x64\SharedManagementObjects.msi for the X64 version
- ENU\x86\SharedManagementObjects.msi for the X86 version
Hopefully, this blog would help some developer who has no idea about SQL Server versions jargon.
Reference: Pinal Dave (https://blog.sqlauthority.com)
First appeared on SQL SERVER – Error: Could not Load File or Assembly Microsoft. SqlServer. management. sdk. sfc Version 12.0.0.0