sql - 是否可以使用 "Invoke-SqlCmd"作为 Visual Studio Online 构建步骤的一部分?

标签 sql powershell azure tfsbuild azure-devops

我们尝试将数据库更新为 Visual Studio Online 构建的一部分(作为专用构建步骤),但我们本地使用的 PowerShell 脚本无法在托管构建 Controller 上运行,并出现以下错误。

2015-07-28T20:35:26.8546681Z ##[error]import-module : The specified module 'sqlps' was not loaded because no valid module file was found in any module 

2015-07-28T20:35:26.8546681Z ##[error]directory.

有没有办法在 VSO 托管构建 Controller 中使用“Invoke-SqlCmd”?

enter image description here

最佳答案

用这些线就可以了!

Add-PSSnapin SqlServerCmdletSnapin100 -ErrorAction SilentlyContinue
Add-PSSnapin SqlServerProviderSnapin100 -ErrorAction SilentlyContinue

关于sql - 是否可以使用 "Invoke-SqlCmd"作为 Visual Studio Online 构建步骤的一部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31686713/

相关文章:

powershell - 在 PowerShell 中执行 `where.exe`

azure - 将文件从 Azure Blob/文件存储移动到 Azure FTP 空间

mysql - 从文件更新 SQL 表中的值

SQLite 子查询数学返回错误值

windows - 带有特殊字符的密码参数

azure - 数百个 Service Fabric 证书错误

c# - Azure 发布或打包失败但没有错误

mysql - 如何获得每个类别的前 5 名

sql - 如果两个连续事件的时间戳差异超过 30 分钟,则填充 session ID 并生成新的 session ID

powershell - 无法在 DevOps 上并行执行 Powershell 7 脚本