gpt4 book ai didi

powershell - 升级后 SqlPackage.exe 命令抛出错误

转载 作者:行者123 更新时间:2023-12-04 00:53:12 24 4
gpt4 key购买 nike

我们使用 PowerShell 脚本来部署 SQL 数据库。此脚本使用 SqlPackage.exe 实用程序发布我们的主数据库,它工作正常,直到我们将 SSDT 升级到最新版本 SSDT 2015 时它声明抛出以下错误。

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.

最佳答案

您的部署环境似乎缺少 SqlDom 版本 12 (Microsoft.SqlServer.TransactSql.ScriptDom.dll),它应该在 GAC 中。您可以从此处的 SQL Server 2014 功能包页面下载它:https://www.microsoft.com/en-us/download/details.aspx?id=42295

您应该下载并安装两个文件 - SqlDom.msi 的 x64 和 x86 版本。

看来您当前使用的是 SQL Server 2014 版本的数据层应用程序框架。请注意,如果更新到 SQL Server 2016 版本的数据层应用程序框架 (DacFX),则需要确保还安装了更新版本 (v13) 的 DacFX 依赖项(SqlSysClrTypes.msi 和 SqlDom.msi) .

关于powershell - 升级后 SqlPackage.exe 命令抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37336905/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com