SSDT Database Reference on .dacpac file of a different solution project

  • We have a database project, DB1 that depends on a database project, DB2 located in a separate database project solution (separate repository). We referenced the dacpac file of DB2 which is located in the bin\Debug directory of the database project. However, we are getting a build error below. My guess is that it could not resolve the database reference to the dacpac file. Would dynamic database reference work and if so, any example would help.

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets(559,5): Error: MSB4018: The "SqlBuildTask" task failed unexpectedly.

    System.NullReferenceException: Object reference not set to an instance of an object.

    at Microsoft.Data.Tools.Schema.UserInteractionServices.GetElementName(IModelElement element, ElementNameDetails details)

    at Microsoft.Data.Tools.Schema.Sql.SqlUserInteractionServices.GetElementName(IModelElement element, ElementNameDetails details)

    at Microsoft.Data.Tools.Schema.Sql.SqlAzureV12UserInteractionServices.GetElementName(IModelElement element, ElementNameDetails details)

    at Microsoft.Data.Tools.Schema.Sql.Validation.MismatchedNameRule.Analyze(SqlSchemaModel sqlSchemaModel, ISqlModelElement sqlElement, SqlRuleSetting ruleSetting, SqlRuleExecutionContext context)

    at Microsoft.Data.Tools.Schema.Sql.Validation.SqlValidationRuleProxy.Analyze(SqlSchemaModel sqlSchemaModel, ISqlModelElement sqlModelElement, SqlRuleSetting ruleSetting, SqlRuleExecutionContext context)

    at Microsoft.Data.Tools.Schema.Sql.Validation.SqlValidationRule.Analyze(SqlRuleSetting ruleSetting, SqlRuleExecutionContext context)

    at Microsoft.Data.Tools.Schema.Sql.RuleEngine.SqlRuleEngine.ExecuteRuleImpl(SqlRuleSetting ruleSetting, SqlRuleExecutionContext context, Predicate1 suppressProblem, IEnumerable1& errors)

    at Microsoft.Data.Tools.Schema.Sql.RuleEngine.SqlRuleEngine.ExecuteRules(SqlSchemaModel dataSchemaModel, IEnumerable1 ruleSettings, IEnumerable1& errors, Predicate1 suppressProblem, Func1 executeCanceled)

    at Microsoft.Data.Tools.Schema.Sql.RuleEngine.SqlRuleEngine.ExecuteRules(SqlSchemaModel dataSchemaModel, IEnumerable1 rules, IEnumerable1& errors, Predicate1 suppressProblem, Func1 executeCanceled)

    at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.RunBuildValidation(SqlSchemaModel model, ErrorManager errorContainer, Func1 buildCanceledQuery, HashSet1 excludedRuleIDs)

    at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.OnRunBuildValidations(ErrorManager errorManager)

    at Microsoft.Data.Tools.Schema.Sql.Build.SqlTaskHost.RunBuildValidations(ErrorManager errorManager)

    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.LoadImpl(ITaskHost providedHost, TaskLoggingHelper providedLogger)

    at Microsoft.Data.Tools.Schema.Tasks.Sql.TaskHostLoader.Load(ITaskHost providedHost, TaskLoggingHelper providedLogger)

    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteLoadTaskHostStep()

    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.ExecuteStep(Func`1 step)

    at Microsoft.Data.Tools.Schema.Tasks.Sql.SqlBuildTask.Execute()

    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

  • I found that the dacpac file name should be the same name as the actual database name. The dacpac file name of DB2 was created with the name of the project which is DB2_native (DB2_native.dacpac). SSDT is expecting the file name to be DB2.dacpac where DB2 is the name of the database.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply