microsoft / microsoft/vscode-mssql
[Bug]: Publish fails to find .dacpac for project containing <SqlTargetName> tag
- Dominant language
- TypeScript
- Stars
- 1.9k
- Forks
- 610
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 97
Description
### Description
The Publish Project dialog doesn't properly handle a project that contains a `` tag in its .sqlproj file when that tag sets the default .dacpac output file name to anything other than the name of the project itself. Whether generating a deployment script or applying changes directly, the project build step completes successfully and creates a file matching the `SqlTargetName`, but the schema compare and/or deployment steps that follow fail to find the .dacpac because they're looking for what it would be called if there were no `SqlTargetName` involved.
### Steps to Reproduce
1. Open any database project (newly created via `dotnet new sqlproj` is fine) and add/modify the `` tag in the .sqlproj to set its value to anything that doesn't match the name of the .sqlproj file.
* I've used a project called "DatabasePublishTest.sqlproj" with "MyCustomTargetName" as the `` value for my example below.
2. Open the Publish Project dialog and set the destination connection information. Any server/database works, and Advanced options are irrelevant.
3. Click either the `Generate Script` or `Publish` button.
4. Observe the build output, where the name of the resulting .dacpac file matches the `` value:
> dotnet build /Users/bwalters3/Projects/DatabasePublishTest/DatabasePublishTest.sqlproj /p:NetCoreBuild=true /p:SystemDacpacsLocation="/Users/bwalters3/.vscode/extensions/ms-mssql.sql-database-projects-vscode-1.5.8/BuildDirectory"
>
> Restore complete (0.2s)
> DatabasePublishTest netstandard2.1 succeeded (1.3s) → bin/Debug/MyCustomTargetName.dacpac
>
> Build succeeded in 1.9s
5. Observe the error message that appears after the build, where the .dacpac file name is expected to match the .sqlproj file name instead:
> mssql: Generate script: Failed. Could not load package from '/Users/bwalters3/Projects/DatabasePublishTest/bin/Debug/DatabasePublishTest.dacpac'. Could not find file '/Users/bwalters3/Projects/DatabasePublishTest/bin/Debug/DatabasePublishTest.dacpac'.
### Affected Area
- [ ] Connection dialog (SQL Server | Azure browse/Fabric browse)
- [ ] Query editor
- [ ] Query results panel
- [ ] Object Explorer
- [ ] GitHub Copilot integration
- [ ] Preview/Edit data
- [ ] Table Designer
- [ ] Schema Designer
- [ ] Schema Compare
- [ ] Local SQL Server Container provisioning
- [ ] SQL database in Fabric provisioning
- [ ] DACPAC/BACPAC export/import
- [x] SQL Database projects
- [ ] Query Plan Visualizer
- [ ] Other (please describe below)
### If you selected "Other", please describe the affected area
_No response_
### Environment Information
- VS Code version: 1.115.0
- MSSQL extension version: 1.41.0
- SQL Database Projects extension version: 1.5.8
- OS: macOS 26.4.1
### Confirmation
- [x] I have searched existing issues and couldn't find a match
- [ ] I want to work on this issue
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Publish Project dialog flow used by Generate Script and Publish, then trace how the build output from the .sqlproj is passed to schema comparison or deployment. Reproduce the case with a custom and verify that both operations use the generated MyCustomTargetName.dacpac rather than the project filename.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql, typescript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100