Search code examples
dacpacsqlpackage

Invalid object name error: DACPAC Deployment using SQLPackage.EXE


I’m facing an issue when deploying a DACPAC to a SQL server (SQL 2014 – 12.0.2430). Here’s the error I’m getting: invalid object name dbo.usp_SomeStoredProcedure_Update.

This happens if I’m altering a stored procedure. Though, the DB project gets built successfully. I’m using VS 2013 Update 4 for building database solution.

Here’s the command that I’m firing:

“C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin\SQLPackage.exe” /TargetDatabaseName:DBName /TargetServerName:ServerName /Action:Publish /SourceFile:DBName.dacpac /p:IncludeTransactionalScripts=true /p:BlockOnPossibleDataLoss=false /p:DropIndexesNotInSource=false /p:GenerateSmartDefaults=true

Any idea what might be happening?


Solution

  • Ok, so I went ahead with one work around. I generated the scripts using /Action:Script, and then deployed this script using Invoke-SQLCmd PowerShell command. And, it works.

    Not sure what is the exact cause of the issue. But the above workaround works.