Skip to content

Copy dll from global‑packages to output #10518

Closed

Description

Hi I'm Marco from coverlet https://github.com/tonerdo/coverlet

We have an issue with instrumentation through cecil, I'll explain what's happen.
Coverlet is usable through 3 drivers, msbuild, dotnet tool and vstest collectors, and it works for full and core .NET
After a user fire the test command with coverage enabled coverlet instrument needed assemblies.
To do that we use Mono.Cecil.
Mono.Cecil sometimes need to load referenced assemblies, but it fails to load transitive reference(for instance testing apps that usesMicrosoft.Extensions.Logging.Abstractions)
Default cecil resolver does not resolve from global-packages location.
One solution users try is to reference missed dll in csproj, but it doesn't work because there is no way to "copy PackageReference dll to output folder", i.e. on test project:

   ...
   <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
   ...

Now my question: is there a way to force the copy of PackageReference dll on output folder?
Another approach I'm testing is to resolve reference by myself on custom resolver(with one of our user case it works)...but I think's it not possible, because for instance with dotnet tool I'll instrument always with "dotnet core runtime" but I could test full framework app, so I'll load incorrect dll...again with multitarget libs it's a hell, because we need to implement all loading rule with runtime/version matrix.

Current workaround is manual copy dll on output folder.
Coverlet reference issue coverlet-coverage/coverlet#560

cc: @tonerdo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions