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
314 stars 19 forks source link

Rules not being picked up by 0.2.3 #495

Closed ErikEJ closed 1 week ago

ErikEJ commented 2 weeks ago

Steps to Reproduce:

  1. Add package ref to third party rules package
  2. Build does not report errors from 3rd party package

Did this occur in prior versions? If not - which version(s) did it work in?

(DacFx/SqlPackage/SSMS/Azure Data Studio)

ErikEJ commented 2 weeks ago

But maybe 0.2.3 does not include that?

ErikEJ commented 2 weeks ago

It does not. I wish the release proces / release notes were more transparent.

zijchen commented 1 week ago

Hi @ErikEJ yeah we're working on having the SDK release notes on GitHub. Which package are you trying to use? We currently support analyzer packages that are built using the C# way with analyzers in analyzers/dotnet/cs

ErikEJ commented 1 week ago

@zijchen Does 0.2.3 support analyzer packages??

I am using my own package and the files are in the correct location

zijchen commented 1 week ago

0.2.3 should support it, I just verified it locally as well. Do you mind sharing your binlog file?

ErikEJ commented 1 week ago

I am testing with an updated .sqlprojx. Let me do a simpler test in ADS.

zijchen commented 1 week ago

Sounds good, let us know your findings. Also, make sure you have <RunSqlCodeAnalysis>true</RunSqlCodeAnalysis> in your project, it's easy to miss.

If everything's working correctly, you should see the analyzer assembly added during the ResolveLockFileAnalyzers target in the binlog image

ErikEJ commented 1 week ago

@zijchen A plain dotnet build in ADS (no .sqlprojx involvement) works as expected! 🎉

Guess .sqlprojx needs the latest DacFX somwhere?

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build">
  <Sdk Name="Microsoft.Build.Sql" Version="0.2.3-preview" />
  <PropertyGroup>
    <Name>TestCA</Name>
    <ProjectGuid>{F6384BD0-0462-45C9-90FF-80BF08AB39CA}</ProjectGuid>
    <DSP>Microsoft.Data.Tools.Schema.Sql.Sql160DatabaseSchemaProvider</DSP>
    <ModelCollation>1033, CI</ModelCollation>
    <RunSqlCodeAnalysis>true</RunSqlCodeAnalysis>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="ErikEJ.DacFX.SqlServer.Rules" Version="1.1.0" />
    <PackageReference Include="ErikEJ.DacFX.TSQLSmellSCA" Version="1.1.0" />
  </ItemGroup>
</Project>