Simon Green
Simon Green

Reputation: 1161

Error SQL0: The reference to external elements from the source named 'MyDatabase.dacpac' could not be resolved, because no such source is loaded

I'm getting this error when using sqlpackage.exe, or the DacFx DLLs, to programmatically publish a dacpac (A), compiled and provided by a different team, which in turn has a dependency on another dacpac (B).

I can confirm that:

What am I doing wrong? How can I publish a dacpac that has been compiled and provided to me, which has a database reference that is referenced with a path that is invalid for me?

Upvotes: 4

Views: 2487

Answers (1)

robyaw
robyaw

Reputation: 2311

This can occur when you switch between editions of Visual Studio. In my scenario, I originally built a database project using VS2017 Professional Edition. When I switched to VS2017 Enterprise Edition, I received a bunch of The reference to external elements from the source named 'master.dacpac' could not be resolved, because no such source is loaded. errors on build (it also occurs when building in Enterprise first, then switching to Professional).

I resolved this as follows:

  • Close Visual Studio;
  • Delete the *.dbmdl, *.jfm and *.user files in the project root folder;
  • Re-open Visual Studio and re-build.

Upvotes: 4

Related Questions