0

I'm running

Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir

and getting the error 'Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo'

I tried installing Microsoft Visual C++ Redistributable for Visual Studio 2013 and 2017

I tried adding the DLL in question(which IS contained in the DbaTools module) to the GAC using the CMD below

gacutil.exe /i "C:\Program Files\WindowsPowerShell\Modules\dbatools\bin\smo\Microsoft.SqlServer.ConnectionInfo.dll" 

I tried installing the newest version of DbaTools(~0.9.x at time of writing) using the Powershell below

Invoke-Expression (Invoke-WebRequest -UseBasicParsing https://dbatools.io/in) 

Inputted command and complete outputted error message are both below

Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir

'Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo' Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91 or one of its dependencies. The system cannot find the file specified.'
derekbaker783
  • 8,109
  • 4
  • 36
  • 50
  • Do you have Microsoft SQL Server Management Studio or SQL server installed? – HAL9256 Apr 12 '19 at 22:55
  • @HAL9256, yes, I'm running the cmdlet directly on the host where the SQL-instance lives. It's SQL Server 2012, and the assembly version appears to suggest the version is part of the issue. Also, the cmdlet DOES generate several scripts successfully, but produces that error toward the end of its run (replication?). I can run the cmdlet against the server from my local machine against that server with no issue, but I need to run it from a SQL-Agent job on the server. I do NOT have the latest version of SSMS installed on that host, but do have A version of SSMS installed there (2012) – derekbaker783 Apr 12 '19 at 23:12

1 Answers1

0

If I opt out of exporting replication settings, there is no attempt to load the problematic assembly, and the cmdlet runs as expected.

Export-DbaInstance -SqlInstance $sourceServerName -Path $absPathToBackupScriptDir -Exclude 'ReplicationSettings'
Alex Myers
  • 6,196
  • 7
  • 23
  • 39
derekbaker783
  • 8,109
  • 4
  • 36
  • 50