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

Fix for code analyzer support on Visual Studio 2017 (fixes #394) #467

Merged
merged 2 commits into from
Apr 15, 2021

Conversation

NightOwl888
Copy link
Contributor

Fixes #394.

This downgrades our code analyzers from .NET Standard 2.0 to .NET Standard 1.3 to fix analyzer loading issues in Visual Studio 2017 when referencing the Lucene.Net NuGet package.

image

It also downgrades Microsoft.CodeAnalysis.CSharp.Workspaces and Microsoft.CodeAnalysis.VisualBasic.Workspaces to 2.6.1 and adds direct dependencies on Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis.VisualBasic. There is an unofficial guide that describes how this versioning works, but this should add support for Visual Studio 15.6.1 and higher (previously it was 16.4.0 and higher).

The patch was confirmed to work on Visual Studio 15.9.29 as well as Visual Studio 16.8.2 in both C# and Visual Basic.

A Version.props file was also added so we can manually bump the binary version (version revision only) whenever a change is made, which is a requirement of Visual Studio to be able to reload an analyzer. This will prevent workarounds like #286 (comment) from being necessary, and helps to ensure we are verifying the correct copy when debugging.

NOTE: An attempt was made to detect the Visual Studio version and disable installation of the analyzer using the install.ps1 script, but it turns out that scripting support in NuGet packages is now deprecated and analyzers are now loaded by convention rather than with scripts. The scripts (which even Microsoft's NuGet-packaged analyzers ship with) are only for backward compatibility support with older VS versions and exit early to prevent double-installation from happening when convention-based support exists.

References

… to manually bump the assembly number by one revision on any code change (VS requires this, see: dotnet/roslyn#4381 (comment)).
…andard 1.3 to support VS2017. Added missing dependencies on Microsoft.CodeAnalysis.CSharp and Microsoft.CodeAnalysis.VisualBasic and adjusted version numbers using this reference: https://roslyn-analyzers.readthedocs.io/en/latest/how-to-start.html. (fixes apache#394)
@NightOwl888 NightOwl888 added this to the 4.8.0-beta00015 milestone Apr 15, 2021
@NightOwl888 NightOwl888 merged commit 6a833fd into apache:master Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant