-
Notifications
You must be signed in to change notification settings - Fork 21
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
.NET Standard 2.0 Removal complicates .NET Source Generator development #111
Comments
Oh, yeah, this would be catastrophically painful for Dapper. I'd basically need to fork SqlScriptDOM if this (from here) can't go back (thanks for the tip, @Tornhoof). netstandard2.0 has a special place in hell, as analyzers are basically restricted to netstandard2.0; (btw, it isn't just codegen; |
@Tornhoof Where do you see signs of .NET Standard 2.0 removal from this library? |
See my edit, or: this PR: a6592c7 |
Yeah that's the one, I'm currently working around it in my own code with the following hack: <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
<PackageReference Include="Microsoft.SqlServer.TransactSql.ScriptDom" PrivateAssets="all" GeneratePathProperty="true">
<NoWarn>NU1701</NoWarn>
</PackageReference>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(OutputPath)\$(AssemblyName).xml" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="$(PkgMicrosoft_SqlServer_TransactSql_ScriptDom)/lib/net462/Microsoft.SqlServer.TransactSql.ScriptDom.dll" PackagePath="analyzers/dotnet/cs" Pack="true" Visible="false" />
</ItemGroup> |
@llali FYI - I suggest reverting - no real reason to drop support for .NET Standard |
Hello,
The Sql Sript DOM library is quite useful for .NET Source Generators, as it makes it possible to parse SQL statements to decide on proper C# source generation, e.g. parse SELECT statement columns to create proper column mappings etc or in general do dev time analysis of sql statements.
.NET source generators and or analyzers are targeting .NET standard 2.0 projects, as they need to run on both Visual Studio roslyn (.netfx) and everything more modern (.net 8+).
Examples of libraries using this approach is DapperAOT by @mgravell, i think he was the first to use the SQL script dom lib to parse sql statements to figure out code generation.
While it is possible to suppress NU1701 (the wrong tfm warning) per package, it would be quite nice if you'd add netstandard2.0 back again, as roslyn analyzers and source generators with external dependencies are already quite messy to develop.
The text was updated successfully, but these errors were encountered: