Thursday, July 6, 2017

Add-Type : Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

I am new to SQL Server Management Objects (SMO)

I tried

Add-Type -AssemblyName "Microsoft.SqlSever.Smo"

but got this error:

Add-Type : Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

Knowing that my machine has had multiple versions of SQL and Visual Studio installed at some point, I decided to opt for the latest and provide the FullName of the assembly instead:

Add-Type -AssemblyName 'Microsoft.SqlServer.Smo, Version=13.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'

That seemed to work. Yes, I did get the assembly first to verify that all the referenced assemblies are there. Not sure why the loader would default to 9.0.242.0, but that is not my problem right now.



No comments:

Post a Comment