18

We have two database projects, x and x_audit. x has a reference to x_audit.

x_audit deploys fine, but when trying to deploy x we get the error:

The reference to external elements from the source named x_audit.dbschema could not be resolved, because no such source is loaded.

The same files work fine deploying to a 2005 database, we only get this error when deploying to 2008. If it makes any difference, this is upgrading an existing database rather than creating a new one. It used to work fine on both 2005 and 2008, not sure what's changed.

Thanks

Matt
  • 1,494
  • 2
  • 18
  • 38
  • We've worked around this for the moment by removing the reference. We get a lot of warnings when building the project, but at least you can still deploy from it – Matt Jul 10 '12 at 07:41

2 Answers2

22

When you add the database reference, check the checkbox to "Suppress error caused by unresolved references in the referenced project".

The vague language about "external elements" means x_audit has a reference to something too. And that something is not referenced by x, so x doesn't know about it.

Tim Partridge
  • 3,365
  • 1
  • 42
  • 52
11

If you have a database "A" referring to an external database dacpac "B", you need to include all the necessary references from "B" in the project for "A" or "A" won't build. Alternatively, you can set suppress unresolved references to True and the compiler will ignore the missing references.

Suppressing unresolved references is necessary if you have circular references between your databases.

enter image description here

FistOfFury
  • 6,735
  • 7
  • 49
  • 57
  • 1
    Are you saying that if I have a solution with two database projects in it, A and B, where B has references to dacpac's C, D, and E (and B builds just fine) and A has a reference to B, then I have to ALSO include references to the C, D, and E dacpac's in the A project?? – Mike K Feb 26 '15 at 20:13
  • 1
    @MikeK - you have two options. 1) include DACPAC for the other databases that B references to project A. 2) Set the "Suppress Reference" option to true in project A. – FistOfFury Mar 02 '15 at 15:25
  • I did, indeed, do this and it worked. Seems baffling to me that these projects cannot be truly separate. Thanks for the assist. – Mike K Mar 03 '15 at 17:55
  • That circular dependency thing was puzzling me, thanks for pointing that out. Any idea/experience that if suppressing these errors would come back to bite in the back? – haku Feb 29 '16 at 02:00