Skip to content

Problem with multi targeted dependency with code analysers  #6500

Closed
@mattbrailsford

Description

@mattbrailsford

Description

I seem to be having problems with a multi targeted project which has a dependency on Lucene.net.

In the .NET Framework target it has a v3.x dependency on the library where as in the .NET Core target it has a v4.x dependency.

The issue is, the v4.x dependency contains code analysers within it but the v3.x version doesn’t. It seems however if one version has them it expects the other also to have them and so the build errors.

Metadata file 'C:\Users....nuget\packages\lucene.net\3.0.3\analyzers\dotnet\cs\Lucene.Net.CodeAnalysis.CSharp.dll' could not be found

The only way I’ve found a way round this is to copy the v4 analysers into the v3 package folder and then it works.

To reproduce you can create a multi targeted project for net472 and net5.0 and then add lucene dependencies to both with net472 having a v3 dependency and net5.0 having a v4 lucene dependency. Attempting to build the project will fail.

Running in Windows 10 x64, VS 2019

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