Skip to content

Unable to use Roslyn v2.3.0 built analyzers in visual Studio 2017 v15.3.5. #22368

Closed
@msbasanth

Description

@msbasanth

Hi,

Version Used:
Microsoft.CodeAnalysis - v2.3.0
Visual Studio 2017 v15.3.5

Steps to Reproduce:

  1. Installed .Net Core 2.0 SDK so that we can work with .Net Standard v2.0 in Visual Studio 2017.
  2. Created a .Net Standard project. It created in new csproj structure with netstandard2.0
  3. I added reference to Microsoft.CodeAnalysis v2.3.0
  4. Created an analyzer and used that analyzer DLL in another project.
  5. I am getting an error IDE1003,
    Error IDE1003 Analyzer assembly 'XXX.dll' depends on 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' but it was not found. Analyzers may not run correctly unless the missing assembly is added as an analyzer reference as well.

I could also see other errors
CS8032 An instance of analyzer XXXAnalyzer cannot be created from XXXAnalyzer.dll : Exception has been thrown by the target of an invocation.

Expected Behavior:
Should be able to run analyzer when build using Visual Studio 2017. Analyzer should run and show violation if any.

Actual Behavior:
Shows above mentioned errors and it shows unable to create analyzer instance.

The same analyzer when I used older csproj format and Roslyn version 1.2.0.0 it worked fine.

I saw few other issues mentioned about Roslyn version incompatibility with Visual Studio 2017.
Whether we can use latest stable Roslyn version v2.3.0 for developing analyzers which will run in Visual Studio 2017 15.3.5? Please let me know Microsoft.CodeAnalysis version we should use for developing analyzers which will be running in Visual Studio 2017 v15.3.5.

Thanks
Basanth

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions