diff --git a/.gitmodules b/.gitmodules index 543ffa9c..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "sqltoolsservice"] - path = sqltoolsservice - url = https://github.com/microsoft/sqltoolsservice.git diff --git a/Directory.Build.props b/Directory.Build.props index 9b1b069c..1b3f5880 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ - 3.6.146 + 3.7.112 all diff --git a/sqltoolsservice b/sqltoolsservice deleted file mode 160000 index 54fe38ef..00000000 --- a/sqltoolsservice +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 54fe38ef951605e313c7ddc0cc1df4815c85a53a diff --git a/src/DacpacTool/DacpacTool.csproj b/src/DacpacTool/DacpacTool.csproj index 417c4980..0c32bfc4 100644 --- a/src/DacpacTool/DacpacTool.csproj +++ b/src/DacpacTool/DacpacTool.csproj @@ -10,13 +10,14 @@ true - - ../../sqltoolsservice/src - $(SqlToolsPath)/Microsoft.SqlTools.ManagedBatchParser - + + + Always + + - + @@ -24,13 +25,11 @@ - - - - - - - + + + Microsoft.SqlTools.ManagedBatchParser.dll + True + diff --git a/src/DacpacTool/Microsoft.SqlTools.ManagedBatchParser.dll b/src/DacpacTool/Microsoft.SqlTools.ManagedBatchParser.dll new file mode 100644 index 00000000..e9fb3a17 Binary files /dev/null and b/src/DacpacTool/Microsoft.SqlTools.ManagedBatchParser.dll differ diff --git a/src/DacpacTool/PackageDeployer.cs b/src/DacpacTool/PackageDeployer.cs index 04dd8d20..3808462a 100644 --- a/src/DacpacTool/PackageDeployer.cs +++ b/src/DacpacTool/PackageDeployer.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Linq; using Microsoft.Data.SqlClient; @@ -172,8 +173,7 @@ private void RunDeploymentScriptFromReferences(FileInfo dacpacPackage, string ta _console.WriteLine($"Running {scriptPrefix}-deployment script for referenced package '{referencedPackage.Name}' version '{referencedPackage.Version}'"); _currentSource = $"{referencedPackage.Name}/{scriptPrefix}deploy.sql"; - var scriptExecutionArgs = new ScriptExecutionArgs(script, connection, 0, executionEngineConditions, this); - AddSqlCmdVariables(scriptExecutionArgs, targetDatabaseName); + var scriptExecutionArgs = new ScriptExecutionArgs(script, connection, 0, executionEngineConditions, this, 1, AddSqlCmdVariables(targetDatabaseName)); engine.BatchParserExecutionError += (sender, args) => _console.WriteLine(args.Format(_currentSource)); engine.ScriptExecutionFinished += (sender, args) => _console.WriteLine($"Executed {scriptPrefix}-deployment script for referenced package " + @@ -182,13 +182,19 @@ private void RunDeploymentScriptFromReferences(FileInfo dacpacPackage, string ta } } - private void AddSqlCmdVariables(ScriptExecutionArgs args, string targetDatabaseName) + private Dictionary AddSqlCmdVariables(string targetDatabaseName) { - args.Variables.Add("DatabaseName", targetDatabaseName); + var result = new Dictionary(StringComparer.CurrentCultureIgnoreCase) + { + { "DatabaseName", targetDatabaseName } + }; + foreach (var variable in DeployOptions.SqlCommandVariableValues) { - args.Variables.Add(variable.Key, variable.Value); + result.Add(variable.Key, variable.Value); } + + return result; } private void HandleDacServicesMessage(object sender, DacMessageEventArgs args) diff --git a/test/DacpacTool.Tests/DacpacTool.Tests.csproj b/test/DacpacTool.Tests/DacpacTool.Tests.csproj index a8fa5eb6..e28c615c 100644 --- a/test/DacpacTool.Tests/DacpacTool.Tests.csproj +++ b/test/DacpacTool.Tests/DacpacTool.Tests.csproj @@ -10,6 +10,10 @@ false + + + + @@ -17,6 +21,9 @@ + + Always + Always @@ -28,6 +35,10 @@ + + + + @@ -45,6 +56,12 @@ + + + ..\..\src\DacpacTool\binaries\Microsoft.SqlTools.ManagedBatchParser.dll + + + Never