Unresolved dependency when publishing SQL project

Ananias Hildebrand 1 Reputation point
2022-08-15T12:37:44.767+00:00

I am trying to pull a dacpac from an existing database, importing it into a new SQL Project in VS2022 and then publishing it to another server.

I can sucessfully create and import the .dacpac and build the project. However, when I try to publish it via the right click Publish menu entry, I get several errors for unresolved dependencies:

[MyAssembly1] has an unresolved dependency to [System.Runtime.Remoting]. A deployment script with correct ordering cannot be created.  
[System.Design] has an unresolved dependency to [System.Web]. A deployment script with correct ordering cannot be created.  
[System.Runtime.Remoting] has an unresolved dependency to [System.Web]. A deployment script with correct ordering cannot be created.  
[System.Web] has an unresolved dependency to [System.Design]. A deployment script with correct ordering cannot be created.  
[MyAssembly2] has an unresolved dependency to [MyAssembly3]. A deployment script with correct ordering cannot be created.  
[MyAssembly3] has an unresolved dependency to [System.Runtime.Remoting]. A deployment script with correct ordering cannot be created.  
An error occured during deployment plan generation. Deployment cannot continue.  

I included all named dependencies into my projects References (in fact they already existed in there). But I actually suspect, that this is not a problem of not finding the .dlls, rather than somehow messing up the dependency tree, since as you can see above [System.Web] depends on [System.Design] and vice versa, which seems highly unlikely to me, that there really are circular dependencies in NET Framework standard libraries.

Since the project includes many functions and stored procedures that rely on CLR Assemblies it is not really an option, to just strip the assemblies of the project, to get rid of the dependencies completely.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,675 questions
{count} votes

2 answers

Sort by: Most helpful
  1. YufeiShao-msft 7,056 Reputation points
    2022-08-17T09:17:15.467+00:00

    Hi @Ananias Hildebrand ,

    Like you said, it could be a problem with the generation order, VS could not create a deployment script with correct ordering
    The first object is the referencing name, the second object name is being referenced by it, maybe you can fire up Schema Compare and compare the dacpac file against the target database
    According to some people who are experiencing the same issue, you can try to remove one of the foreign keys in the chain, deploy and run the script to add the foreign key later

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Ananias Hildebrand 1 Reputation point
    2022-08-23T09:08:48.92+00:00

    Today I noticed, that this problem does only occur, when I try to Publish onto a server, where the Db does not yet exist. If I create a Db server, attach the Db to it and then run Publish against it, it does update the attached Database without problems.