I am trying to publish an SSDT project and it is throwing an error "Object reference not set to an instance of an object" No other message, is there a way to troubleshoot this.
-
If updating to the latest version doesn't work, please open a connect bug for this. It's a null reference issue, you will likely get the stack trace if you enable logging (see https://the.agilesql.club/Blogs/Ed-Elliott/Enable-SSDT-And-DacFx-Logging). – Kevin Cunnane Aug 18 '17 at 19:41
-
Hi Kevin, It was also failing with VSO release task also, later I have refreshed my database from production and it got fixed. Something in target db which caused VSO & Visual Studio to freak out. – Shiju Samuel Aug 21 '17 at 05:58
-
OK. If you do get the debug log and find the stack trace, please send to kcunnane [at] microsoft [dot] com and I can take a look. Worth trying to fix as usually null checks are easy once you have a search area. – Kevin Cunnane Aug 21 '17 at 17:44
5 Answers
I had the same error and it was because of the build configuration.
The SSDT was missing the current solution build config. After adding it via Configuration Manager to the SSDT it worked again.

- 61
- 1
- 6
-
1This problem and this resolution have happened to me twice now - in my case Visual Studio was set to an incorrect solution configuration value from another code branch. – onupdatecascade Dec 30 '21 at 17:34
I got this error when right-clicking on a DB project and selecting Publish..
(although nothing was showing at all in the Data Tools Operation window, unlike OP)
I built the project, then Publish...
started working again :)
Using SQL Server Data Tools 15.1.61810.11040

- 3,464
- 2
- 33
- 38
I have seen that along with "target unavailable", and downloading and installing the latest SSDT from here usually fix the issue. Make sure your project target is SQL Azure Database as explained here.

- 13,893
- 2
- 24
- 30
I ran into this issue yesterday and discovered the root cause this morning through trial and error.
For me, this was caused by SSDT attempting to update a partition scheme and function. It tries to do this by dropping and recreating the partition scheme and function but it obviously can't do this while they are being used. As a result, it fails to generate the upgrade script with the dreadfully unhelpful error above.
If you don't need to update the partitioning (i.e. if you have something else managing it), you can disable the check in the advanced publish settings:
As shown in the description above, this should ignore any changes to the partition schemes and functions when running the comparison, but still deploy them initially. This resolves the error during script generation.
If you need to update the partition scheme/function, I would recommend doing so as a post-deploy script so that you have better control over the code being executed.

- 21
- 1
-
This solution helped me with not Azure DB but with usual SQL Server Database – Nick Nov 22 '18 at 08:13
What version of SSDT do you have?
This issue was fixed in our most recent sprint, so the latest version of SSDT should unblock you.
https://learn.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt

- 29
- 1
- 1