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

Allow overriding dacpac filename for a package reference #396

Closed
jmezach opened this issue Feb 14, 2023 · 10 comments · Fixed by #397
Closed

Allow overriding dacpac filename for a package reference #396

jmezach opened this issue Feb 14, 2023 · 10 comments · Fixed by #397
Labels
enhancement New feature or request

Comments

@jmezach
Copy link
Member

jmezach commented Feb 14, 2023

When adding a PackageReference to a project, MSBuild.Sdk.SqlProj currently assumes that this package contains a .dacpac in the tools folder which has the same name as the package. So for example, if I add a <PackageReference Include="MyPackage"> to the project file, it will look for a file called tools\MyPackage.dacpac and use that as a reference. If such a file does not exist, the package reference is essentially ignored.

While that is a fair assumption that works for most scenarios, and is in fact also the result of doing a dotnet pack on an MSBuild.Sdk.SqlProj project, there are some scenarios where this doesn't hold up. One example is the newly released Microsoft.SqlServer.Dacpacs package, which holds the .dacpac for the master and msdb databases. Ideally you should be able to reference those in an MSBuild.Sdk.SqlProj project, but you can't do that currently.

I would therefore like to introduce the possibility to override the name of the .dacpac on a per PackageReference basis. For example, something like this:

<PackageReference Include="Microsoft.SqlServer.Dacpacs" DacpacPath="tools\master.dacpac" />
@jmezach jmezach added the enhancement New feature or request label Feb 14, 2023
@jmezach
Copy link
Member Author

jmezach commented Feb 14, 2023

@ErikEJ @jeffrosenberg Any thoughts on this?

@ErikEJ
Copy link
Collaborator

ErikEJ commented Feb 14, 2023

Seems slightly Odd having to specify the tools folder, otherwise LGTM

@jmezach
Copy link
Member Author

jmezach commented Feb 14, 2023

Yeah, I guess we could just stick with DacpacFilename instead and assume it is in the tools folder. Not sure if somebody would want to put it into a different folder.

@jeffrosenberg
Copy link
Collaborator

Makes sense to me, we can always add a path parameter if that comes up at some point

@ErikEJ
Copy link
Collaborator

ErikEJ commented Feb 15, 2023

<ItemGroup> 
     <PackageReference Include="Microsoft.SqlServer.Dacpacs" Version="160.0.0" /> 
       <DacpacName>msdb</DacpacName> 
     </PackageReference> 
   </ItemGroup> 
 </Project>

@ErikEJ
Copy link
Collaborator

ErikEJ commented Feb 15, 2023

This is how MS does it.

@jmezach
Copy link
Member Author

jmezach commented Feb 15, 2023

Yeah, that looks good to me. I'll see if I can implement something like that for MSBuild.Sdk.SqlProj.

@ErikEJ
Copy link
Collaborator

ErikEJ commented Feb 15, 2023

Fixing this will fix #64

@ErikEJ
Copy link
Collaborator

ErikEJ commented Feb 15, 2023

@jmezach Notice that there are multiple packages published: microsoft/DacFx#83 (comment)

@jmezach
Copy link
Member Author

jmezach commented Feb 20, 2023

This is now released in version 2.5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants