DacFx icon indicating copy to clipboard operation
DacFx copied to clipboard

Re Publish: Server`s EVENT NOTIFICATION dublicate error

Open Mnior opened this issue 1 year ago • 0 comments

  • SqlPackage or DacFx Version: 162.0.52 (19.2)
  • .NET Framework (Windows-only) or .NET Core: 4.8.04084
  • Environment (local platform and source/target platforms):
    • Windows 10 / Windows Server 2019 Datacenter 10.0 <X64> (Build 17763)
    • VS 2019 (Version 16.11.21) / Microsoft SQL Server 2019 (RTM-CU19) (KB5023049) - 15.0.4298.1 (X64)

Steps to Reproduce:

  1. Create new database project
  2. Add EVENT NOTIFICATION ON Server (name not existed on tested server)
  3. Build
  4. Publish dacpac (on new database), as system admin
  5. Repeat publish dacpac (the same database)
  6. Get exception

First Publish Log:

Publishing to database 'Test' on server 'SQL'.
Initializing deployment (Start)
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Creating Test...
Creating [ENTest]...
Update complete.
Updating database (Complete)
Successfully published database.

Second Publish Log:

Publishing to database 'Test' on server 'SQL'.
Initializing deployment (Start)
Initializing deployment (Complete)
Analyzing deployment plan (Start)
Analyzing deployment plan (Complete)
Updating database (Start)
Creating [ENTest]...
An error occurred while the batch was being executed.
Updating database (Failed)

*** Could not deploy package.
Error SQL72014: .Net SqlClient Data Provider: Msg 2714, Level 16, State 21, Line 1 There is already an object named 'ENTest' in the database.
Error SQL72045: Script execution error.  The executed script:
CREATE EVENT NOTIFICATION [ENTest]
    ON SERVER
    FOR DEADLOCK_GRAPH
    TO SERVICE N'STest', N'current database';

Did this occur in prior versions? If not - which version(s) did it work in? reproduced down to 17.4.1 (14.0.3917.1)

(DacFx/SqlPackage/SSMS/Azure Data Studio)

Mnior avatar Sep 06 '23 14:09 Mnior