Categories: SQL Server

Publish Database Fails – Script File could not be found

A small blog post for anyone who stumbles across this issue (and for my future self, should I forget the solution).

I was working on some tables in SSDT and I tried to publish changes to the database on my local machine. I got a build error because I created a clustered index on the wrong table (which resulted in two clustered indexes on said table). So I fixed the bug and tried to publish. However, even though the build succeeded, I got the following error message:

The script file could not be found.

Well, that’s a first. Rebuilding didn’t work. Re-publishing neither. Eventually, I unloaded the project and removed the .dbmdl file (which seems to be a serialized file of the database model for optimizing deployment performance, as hinted here on Stack Overflow).

Reloading the project into the solution without this file present apparently forces a re-analysis of the project (there used to be a button to reanalyze in previous versions, but I couldn’t find it). Now I could publish the project again.

UPDATE: this might also help if you get the dreaded “null reference not set to an instance of an object” error


------------------------------------------------
Do you like this blog post? You can thank me by buying me a beer 🙂
Koen Verbeeck

Koen Verbeeck is a Microsoft Business Intelligence consultant at AE, helping clients to get insight in their data. Koen has a comprehensive knowledge of the SQL Server BI stack, with a particular love for Integration Services. He's also a speaker at various conferences.

View Comments

Recent Posts

Free webinar – Tackling the Gaps and Islands Problem with T-SQL Window Functions

I'm hosting a free webinar at MSSQLTips.com at the 19th of December 2024, 6PM UTC.…

5 days ago

dataMinds Connect 2024 – Session Materials

The slides and scripts for my session "Tackling the Gaps & Islands Problem with T-SQL…

4 weeks ago

Connect to Power BI as a Guest User in another Tenant

Sometimes your Microsoft Entra ID account (formerly known as Azure Active Directory) is added as…

2 months ago

How to use a Script Activity in ADF as a Lookup

In Azure Data Factory (ADF, but also Synapse Pipelines and Fabric Pipelines), you have a…

4 months ago

Database Build Error – Incorrect syntax near DISTINCT

I wrote a piece of SQL that had some new T-SQL syntax in it: IS…

4 months ago

Speaking at dataMinds Connect 2024

I'm very excited to announce I've been selected as a speaker for dataMinds Connect 2024,…

5 months ago