Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"SQL71508: The model already has an element that has the same name" when using ProjectReference #556

Open
lausitzer opened this issue Jan 30, 2025 · 2 comments
Assignees
Labels
area: build sdk Related to Microsoft.Build.Sql SDK bug Something isn't working fixed-pending-release Fix in upcoming release

Comments

@lausitzer
Copy link

lausitzer commented Jan 30, 2025

  • SqlPackage or DacFx Version:
  • .NET Framework (Windows-only) or .NET Core: .net sdk 8.0.405, Microsoft.SqlPackage 170.0.33-preview
  • Environment (local platform and source/target platforms):

Steps to Reproduce:

  1. Create an solution with 3 sdk-style sql projects (Parent, Child.ArtifactRef and Child.ProjectRef) for Sql150 with dotnet tool. All projects contain the same table definition for [dbo].[Test].
  2. Child.ArtifactRef gets an ArtifactReference to Parent's dacpac. Parent should be in a different database.
  3. Child.ProjectRef gets the same reference to Parent as ProjectReference.
  4. Build Parent-project in a first run to get Parent's dacpac in place.
  5. Build whole solution. Parent and Child.ArtifactRef build fine. Child.ProjectRef fails with "SQL71508: The model already has an element that has the same name" refering to [dbo].[Test] and it's columns. It seems that in case of ProjectReference the build process ignors DatabaseSqlCmdVariable and assumes Parent project and Child.ProjectRef target the same database.

Expected successfull build for all 3 projects.

Find my test solution attached.
TestSolution.zip

@zijchen
Copy link
Member

zijchen commented Feb 6, 2025

This is fixed in #538 and will be in the 1.0.0 release

@zijchen zijchen self-assigned this Feb 6, 2025
@zijchen zijchen added the fixed-pending-release Fix in upcoming release label Feb 6, 2025
@Seuleuzeuh
Copy link

Hi @zijchen, i'm experiencing the same issue with the 1.0.0-rc2 where the fix seems to be added.
I've downladed, upgraded to rc2 and tested the TestSolution of @lausitzer and the bug is not corrected.

I haved missed something ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build sdk Related to Microsoft.Build.Sql SDK bug Something isn't working fixed-pending-release Fix in upcoming release
Projects
None yet
Development

No branches or pull requests

4 participants