Microsoft.Build.Sql v2 preview.1 and .2 - inconsistent sqlcodeanalysis results
@zijchen is already working on this.
Since Jun 25, 2025.
- Dominant language
- C#
- Stars
- 460
- Forks
- 29
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 7
Description
- SqlPackage or DacFx Version: Microsoft.Build.Sql 2.0.0-preview.1 and preview.2
- .NET Framework (Windows-only) or .NET Core: .NET 8 and 9
- Environment (local platform and source/target platforms):
**Steps to Reproduce:**
1. create a sqlproj (2.0.0-preview) with a code analysis finding in a .sql file like
```sql
CREATE PROCEDURE [dbo].[uspLogError]
@ErrorLogID int = 0 OUTPUT
AS
BEGIN
SET @ErrorLogID = @@IDENTITY;
END
```
```xml
AdventureWorks
{B0570FA1-CAA5-4BCD-AFED-B19A548597DB}
Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider
1033, CI
```
2. run build `dotnet build /p:RunSqlCodeAnalysis=true`
3. run build a 2nd time - no warnings
4. delete out bin+obj, run build a third time - warning appears again
**Did this occur in prior versions? If not - which version(s) did it work in?**
this doesn't repro in 1.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.