microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
356 stars 20 forks source link

Unexpected failure when publishing using SqlPackage: Object reference not set to an instance of an object #498

Open rpmrmartin opened 2 months ago

rpmrmartin commented 2 months ago

Steps to Reproduce:

  1. Publish a dacpac using the following command: sqlpackage /Action:Publish '/SourceFile:C:\Users\rmartin\rpm\RPM34\Config\database\RpmSubscriber\bin\Release\RpmSubscriber.dacpac' '/TargetConnectionString:<redacted>' /Variables:GlobalServer=Test34 /Variables:RpmGlobal=RpmGlobal '/Profile:C:\Users\rmartin\rpm\RPM34\Config\database\RpmSubscriber\RpmSubscriber.publish.xml' /Properties:BlockOnPossibleDataLoss=False
  2. Get the following output from SqlPackage:

    Publishing to database '\' on server 'TEST34'. Initializing deployment (Start) Initializing deployment (Failed) Time elapsed 0:00:32.37 *** An unexpected failure occurred: Object reference not set to an instance of an object..

  3. SqlPackage exits with code 1

Publishing to an empty database works fine, but immediately republishing to the same database (now containing the objects in our project) gives the error above. I can't share the dacpac I'm trying to publish publicly but I can share it privately with contributors to this repo.

Did this occur in prior versions? If not - which version(s) did it work in?

No. Used to work in SqlPackage 162.3.566 and 162.2.111