Skip to content
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

Rules don't evaluate on Visual Studio 2022 #52

Open
NathanMSFT opened this issue Dec 1, 2023 · 4 comments
Open

Rules don't evaluate on Visual Studio 2022 #52

NathanMSFT opened this issue Dec 1, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@NathanMSFT
Copy link

I was working with a customer that was trying to implement these rules with Visual Studio 2022. When done through the VS GUI the rules were successfully evaluated, but when done from msbuild.exe, the rules were essentially ignored. The problem was determined to be that the SqlServer.Rules solution was compiled with DacFx 150. It appears this causes issues with the Microsoft Entity Framework such that when MEF tries to match the rules with the required condition, it can’t match the types in 150 and 160. We downloaded the source code of the SqlServer.Rules and compiled it using DacFx 160 and were able to get Visual Studio 2022 to recognize the custom rules and evaluate them when run from msbuild.exe.

If you want to make these custom rules compatible with VS 2022, please rebuild the solution with DacFx 160. This should be backwards compatible such that the new release still works with previous Visual Studio version as well.

Please see microsoft/DacFx#364 for reference.

@ErikEJ
Copy link

ErikEJ commented Feb 25, 2024

@NathanMSFT FWIW, I have published a NuGet package with an updated .dll file: https://www.nuget.org/packages/ErikEJ.DacFX.SqlServer.Rules/

@tcartwright
Copy link
Owner

Thanks guys, I have been away for a while, I will get right on it.

@tcartwright tcartwright self-assigned this Jul 12, 2024
@tcartwright tcartwright added the bug Something isn't working label Jul 12, 2024
@ErikEJ
Copy link

ErikEJ commented Jul 12, 2024

@tcartwright just FYI I have forked the rules and published NuGet packages with rules that work in VS 2022 and also .NET 6 and later

https://erikej.github.io/dacfx/codeanalysis/sqlserver/2024/04/02/dacfx-codeanalysis.html

@ErikEJ
Copy link

ErikEJ commented Jul 13, 2024

Also updated some rules to work well with temporal tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants