Database Project - "Reference to external elements from the source named x could not be resolved
Asked Answered
C

3

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

Casals answered 9/7, 2012 at 7:52 Comment(1)
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 itCasals
U
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.

Ulland answered 11/3, 2014 at 4:18 Comment(0)
S
12

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

Saith answered 14/5, 2014 at 21:11 Comment(4)
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??Favoritism
@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.Saith
I did, indeed, do this and it worked. Seems baffling to me that these projects cannot be truly separate. Thanks for the assist.Favoritism
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?Encarnacion
R
0

To resolve the failing deployment due to missing msdb.dacpac error in project X, I checked other projects to see if they do reference project X. There were 2 such projects - deployment succeeded once the msdb reference was added to all projects referencing the X project. Another solution would be to Suppress unresolved references - in my opinion, that potentially hides other issues the code might have.

Ramon answered 27/1 at 9:10 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Klenk

© 2022 - 2024 — McMap. All rights reserved.