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

Help needed: How to define multiple DacpacName from a single PackageReference? #342

Closed
IVNSTN opened this issue Sep 19, 2023 · 4 comments
Closed
Labels
area: build sdk Related to Microsoft.Build.Sql SDK question Further information is requested

Comments

@IVNSTN
Copy link

IVNSTN commented Sep 19, 2023

  • SDK: 1.0.12-preview
  • .NET Framework (Windows-only) or .NET Core:
  • Environment (local platform and source/target platforms):
  • windows

Docs say that I can do the following if I need one dacpac from a package with multiple dacpacs:

<PackageReference Include="Contoso.Applications" Version="160.0.0">
      <DacpacName>Outfitters</DacpacName>
</PackageReference>

But how should I refer two or three dacpacs from a package with let's say 5 dacpacs?
How to define DatabaseSqlCmdVariable for each dacpac from a single package?
How to define DatabaseSqlCmdVariables if I need all 5 (or more) dacpacs from a package?

(DacFx/SqlPackage/SSMS/Azure Data Studio)

@IVNSTN IVNSTN added the bug Something isn't working label Sep 19, 2023
@zijchen zijchen added question Further information is requested area: build sdk Related to Microsoft.Build.Sql SDK and removed bug Something isn't working labels Sep 27, 2023
@zijchen
Copy link
Member

zijchen commented Sep 27, 2023

@IVNSTN You would need to add the other dacpacs as ArtifactReferences, and you can define DatabaseSqlCmdVariable for each.

<PackageReference Include="Contoso.Applications" Version="160.0.0">
  <DacpacName>Outfitters</DacpacName>
  <GeneratePathProperty>true</GeneratePathProperty>
</PackageReference>
<ArtifactReference Include="$(PkgContoso_Applications)/tools/Dacpac2.dacpac">
  <DatabaseSqlCmdVariable>...</DatabaseSqlCmdVariable>
</ArtifactReference>
<ArtifactReference Include="$(PkgContoso_Applications)/tools/Dacpac3.dacpac">
   <DatabaseSqlCmdVariable>...</DatabaseSqlCmdVariable>
</ArtifactReference>
...

@IVNSTN
Copy link
Author

IVNSTN commented Sep 28, 2023

@zijchen okay, but I don't quite understand this comment then - #273 (comment)

You don't need the ArtifactReference any more if you have the PackageReference already

So are ArtifactReference and PackageReference supposed to be mutually exclusive or SDK can successfully combine them as you mentioned in the comment above?

@IVNSTN IVNSTN closed this as completed Sep 28, 2023
@IVNSTN IVNSTN reopened this Sep 28, 2023
@IVNSTN
Copy link
Author

IVNSTN commented Sep 28, 2023

sorry for closing/reopening - just pressed wrong button.

@zijchen
Copy link
Member

zijchen commented Sep 28, 2023

If your Nuget package only has 1 dacpac inside, the PackageReference can replace the ArtifactReference for that single dacpac. But if you have more than 1 dacpac, you'll still need to use ArtifactReference to add the rest. The 2 aren't mutually exclusive; PackageReference is just syntactic sugar for the common scenario of a single dacpac reference.

@IVNSTN IVNSTN closed this as completed Sep 29, 2023
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 question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants