dermeister0 / DBVer

The tool allows to export SQL Server schema to files and manage them under source control.
MIT License
0 stars 0 forks source link

FileNotFound error when SMO is not installed #1

Open dermeister0 opened 6 years ago

dermeister0 commented 6 years ago
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.Smo, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at DBVer.Program.ProcessDatabase(String dbName, String outputDir, String serverHost, String userName, String password)
   at DBVer.Program.Run(String[] args) in C:\Work\DBVer\src\DBVer\Program.cs:line 102
   at DBVer.Program.Main(String[] args) in C:\Work\DBVer\src\DBVer\Program.cs:line 35

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].

Solutions:

  1. Install SQL Server Management Object 2008 R2.

    https://www.microsoft.com/en-us/download/details.aspx?id=16978

    • Microsoft® System CLR Types for SQL Server® 2008 R2
    • Microsoft® SQL Server® 2008 R2 Shared Management Objects
  2. If you have SMO with newer version, edit assemblyBinding section in DBVer.exe.config.

dermeister0 commented 6 years ago

How to find existing SMO installations:

Get-ChildItem -Recurse 'C:\Program Files (x86)\Microsoft SQL Server' 'Microsoft.SqlServer.Smo.dll'

    Directory: C:\Program Files (x86)\Microsoft SQL Server\110\SDK\Assemblies

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       10/19/2012   3:49 PM        3644928 Microsoft.SqlServer.Smo.dll

    Directory: C:\Program Files (x86)\Microsoft SQL Server\120\SDK\Assemblies

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        2/20/2014   9:44 PM        3720896 Microsoft.SqlServer.Smo.dll

    Directory: C:\Program Files (x86)\Microsoft SQL Server\130\SDK\Assemblies

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----        4/17/2016   9:57 PM        4037832 Microsoft.SqlServer.Smo.dll