microsoft / DacFx

DacFx, SqlPackage, and other SQL development libraries enable declarative database development and database portability across SQL versions and environments. Share feedback here on dacpacs, bacpacs, and SQL projects.
https://aka.ms/sqlpackage-ref
MIT License
362 stars 21 forks source link

$(TargetPath) should be the output .dacpac file #450

Open benjamin-hodgson opened 6 months ago

benjamin-hodgson commented 6 months ago
<Project Sdk="Microsoft.Build.Sql/0.1.15-preview">
    <PropertyGroup>
        <Name>MyDb</Name>
        <DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP>
        <ModelCollation>1033, CI</ModelCollation>
    </PropertyGroup>

    <Target Name="PrintTargetPath" AfterTargets="AfterBuild">
        <Message Importance="high" Text="$(TargetPath)" />
    </Target>
</Project>

The PrintTargetPath target outputs D:\test\MyDb\bin\Debug\MyDb.dll; I would like $(TargetPath) to refer to the output .dacpac file. I have code elsewhere which expects $(TargetPath) to point to the main build output of the project (which logically should be the dacpac in my opinion).

zijchen commented 1 month ago

You can use $(SqlTargetPath) to refer to the dacpac.

I'll try to look for the history of why SqlTargetPath was introduced instead of using TargetPath directly, and see if this is something we can change without breaking backwards compatibility.