我有一个Cake脚本,可以很好地为我到目前为止使用的任何SQL Server实例上部署两个DACPAC。相同的DACPAC从Visual Studio 2017成功部署到SQL Azure,因此我知道它们也与此兼容。
但是,当我使用Cake脚本定位SQL Azure时,只有两个DACPAC中的 first 成功部署。第二个失败,并显示以下错误消息:“错误SQL72020:不支持目标架构的兼容性级别。”如果需要的话,以下是我的Cake任务:
Task("Create-Test-Database")
.Does(() =>{
var connectionString = GetConnectionString(false);
var dacpacFile1 = new FilePath(@"../Databases/CoreDatabase/bin/" + configuration + "/CoreDatabase.dacpac");
var dacpacFile2 = new FilePath(@"../Databases/RailDatabase/bin/" + configuration + "/RailDatabase.dacpac");
var settings = new PublishDacpacSettings {
GenerateDeploymentScript = true
};
PublishDacpacFile(connectionString, sqlDb, dacpacFile1, settings);
PublishDacpacFile(connectionString, sqlDb, dacpacFile2, settings);
});
我已经尝试调整数据库项目as described in this other question的兼容性级别,但无济于事。我会很感激任何人的建议。我正在使用下面的所有详细错误信息更新问题,这些信息是从详尽的尝试中捕获的:
执行任务“创建测试数据库”时发生错误。错误: System.AggregateException:发生一个或多个错误。 -> Microsoft.SqlServer.Dac.DacServicesException:无法部署 包。错误SQL72020:目标架构的兼容性级别 不支持。 -> Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: 部署计划生成期间发生错误。部署c 不要继续。在 Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.BuildPlan()
在 Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.Controller.CreatePlan() 在 Microsoft.SqlServer.Dac.DeployOperation。<> c__DisplayClass3。<> c__DisplayClass5.b__1() 在Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(操作 行动) Microsoft.SqlServer.Dac.DeployOperation。<> c__DisplayClass3.b__0(Object 操作,请参见CancellationToken令牌) Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文)-内部异常堆栈跟踪的结尾-在 Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation 操作,DacLoggingContext loggingContext,CancellationToken cancellati onToken)在 Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource,布尔值isDacpac,字符串targetDatabaseName,DacDeploy 选项选项,取消标记,取消标记, DacLoggingContext loggingContext,操作3 reportPlanOperation, Boolean executePlan) at Microsoft.SqlServer.Dac.DacServices.InternalPublish(DacPackage package, String targetDatabaseName, PublishOptions publishOptions, Boole an executePlan) at Cake.SqlServer.SqlDacpacImpl.PublishDacpacFile(ICakeContext context, String connectionString, String targetDatabaseName, String dacpacF ilePath, PublishDacpacSettings settings) in C:\projects\cake-sqlserver\src\Cake.SqlServer\Dac\SqlDacpacImpl.cs:line 36 at Submission#0.PublishDacpacFile(String connectionString, String targetDatabaseName, FilePath dacpacFilePath, PublishDacpacSettings setti ngs) at Submission#0.<<Initialize>>b__0_4() at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass20_0.<Does>b__0(ICakeContext x) at Cake.Core.CakeTask.<Execute>d__43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.DefaultExecutionStrategy.<ExecuteAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.CakeEngine.<RunTask>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.CakeEngine.<RunTargetAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Scripting.BuildScriptHost.<RunTargetAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.Scripting.ScriptHost.RunTarget(String target)
1.MoveNext() ---从上一个引发异常的位置开始的堆栈跟踪- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.CodeAnalysis.Scripting.Script
at Submission#0.<<Initialize>>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.<RunSubmissionsAsync>d__91.<RunSubmissionsAsync>d__21.MoveNext() --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at Cake.Scripting.Roslyn.RoslynScriptSession.Execute(Script script) at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary
2个参数)位于 Cake.Commands.BuildCommand.Execute(CakeOptions选项)位于 Cake.CakeApplication.Run(CakeOptions选项)位于 Cake.Program.Main() --->(内部异常#0)Microsoft.SqlServer.Dac.DacServicesException:无法部署 包。错误SQL72020:目标架构的兼容性级别 不支持。 -> Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: 部署计划生成期间发生错误。部署c 不要继续。在 Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.BuildPlan()
在 Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.Controller.CreatePlan() 在 Microsoft.SqlServer.Dac.DeployOperation。<> c__DisplayClass3。<> c__DisplayClass5.b__1() 在Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(操作 行动) Microsoft.SqlServer.Dac.DeployOperation。<> c__DisplayClass3.b__0(Object 操作,请参见CancellationToken令牌) Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文)-内部异常堆栈跟踪的结尾-在 Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext 上下文) Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation 操作,DacLoggingContext loggingContext,CancellationToken cancellati onToken)在 Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource,布尔值isDacpac,字符串targetDatabaseName,DacDeploy 选项选项,取消标记,取消标记, DacLoggingContext loggingContext,操作3 reportPlanOperation, Boolean executePlan) at Microsoft.SqlServer.Dac.DacServices.InternalPublish(DacPackage package, String targetDatabaseName, PublishOptions publishOptions, Boole an executePlan) at Cake.SqlServer.SqlDacpacImpl.PublishDacpacFile(ICakeContext context, String connectionString, String targetDatabaseName, String dacpacF ilePath, PublishDacpacSettings settings) in C:\projects\cake-sqlserver\src\Cake.SqlServer\Dac\SqlDacpacImpl.cs:line 36 at Submission#0.PublishDacpacFile(String connectionString, String targetDatabaseName, FilePath dacpacFilePath, PublishDacpacSettings setti ngs) at Submission#0.<<Initialize>>b__0_4() at Cake.Core.CakeTaskBuilderExtensions.<>c__DisplayClass20_0.<Does>b__0(ICakeContext x) at Cake.Core.CakeTask.<Execute>d__43.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.DefaultExecutionStrategy.<ExecuteAsync>d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.CakeEngine.<ExecuteTaskAsync>d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.CakeEngine.<RunTask>d__28.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.CakeEngine.<RunTargetAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Scripting.BuildScriptHost.<RunTargetAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Cake.Core.Scripting.ScriptHost.RunTarget(String target)
1.MoveNext() ---从上一个引发异常的位置开始的堆栈跟踪- System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务 任务) Microsoft.CodeAnalysis.Scripting.Script`1.d__21.MoveNext()<---
at Submission#0.<<Initialize>>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.<RunSubmissionsAsync>d__9