Используйте DBUp DLL в сценарии PowerShell для развертывания сценариев базы данных SQL.
$databaseServer = $args['localhost\SQLEXPRESS']
$databaseName = $args['TestDatabase']
$scriptPath = $args['C:\Project\cLAWin\cla\Customers\Seagull\Dev\Joshua\Src\cLA\Database\Deliveries\PatchingScripts']
Add-Type -Path 'C:\RND\PWSEHLL\DbUp-master\DbUp-master\src\dbup-sqlserver\bin\Debug\netstandard2.0\dbup-sqlserver.dll'
Add-Type -Path 'C:\RND\PWSEHLL\DbUp-master\DbUp-master\src\dbup-core\bin\Debug\netstandard2.0\dbup-core.dll'
#[Reflection.Assembly]::LoadFrom('C:\RND\PWSEHLL\DbUp-master\DbUp-master\src\dbup-sqlserver\bin\Release\netstandard1.3\System.Data.SqlClient.dll')
#Add-Type -Path 'C:\RND\PWSEHLL\DbUp-master\DbUp-master\src\dbup-sqlserver'
$dbUp = [DbUp.DeployChanges]::To
$dbUp = [SqlServerExtensions]::SqlDatabase($dbUp,"server=$databaseServer;Database=$databaseName;Trusted_Connection=True;")
$dbUp = [StandardExtensions]::WithScriptsFromFileSystem($dbUp, $scriptPath)
$dbUp = [StandardExtensions]::LogToConsole($dbUp)
$upgradeResult = $dbUp.Build().PerformUpgrade()
Я использую приведенную выше строку кода и получаю сообщение об ошибке ниже.
Upgrade failed due to an unexpected exception:
System.IO.FileNotFoundException: Could not load file or assembly
'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified.
File name: 'System.Data.SqlClient, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a**'
at DbUp.SqlServer.SqlConnectionManager.<>c__DisplayClass0_0.<.ctor>b__0(IUpgradeLog log, DatabaseConnectionManager dbManager)
at DbUp.Engine.Transactions.DelegateConnectionFactory.CreateConnection(IUpgradeLog upgradeLog, DatabaseConnectionManager databaseConnectionManager)
at DbUp.Engine.Transactions.DatabaseConnectionManager.CreateConnection(IUpgradeLog upgradeLog)
at DbUp.Engine.Transactions.DatabaseConnectionManager.OperationStarting(IUpgradeLog upgradeLog, List`1 executedScripts)
at DbUp.Engine.UpgradeEngine.PerformUpgrade()
Не могли бы вы помочьмне, как у меня выше всех версий .netcore SDK.