我們使用PowerShell腳本來部署SQL數據庫。這個腳本使用SqlPackage.exe工具來發布我們的主數據庫,它工作正常,直到我們將SSDT升級到它的最新版本SSDT 2015時,它聲稱拋出下面的錯誤。升級後SqlPackage.exe命令拋出錯誤
PowerShell腳本行:
& "C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\SqlPackage.exe" /Action:Publish /SourceFile:"$DatabaseDacpacLocation" /TargetServerName:$DataServerSqlInstance /TargetDatabaseName:$Database /Variables:master="$MasterDatabase" /v:DatabaseName="$pDatabaseName" /p:ExcludeObjectType=Sequences
錯誤:
Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Dac.DacPackage' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Microsoft.SqlServer.Dac.DacServices' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SqlSchemaModelStaticState' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.TransactSql.ScriptDom, Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.