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

GitHubActionsTestLogger.dll should not be presented as a reference assembly #36

Open
4 of 5 tasks
AArnott opened this issue Dec 13, 2024 · 1 comment
Open
4 of 5 tasks
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@AArnott
Copy link

AArnott commented Dec 13, 2024

Version

2.4.1

Platform

.NET 8

Steps to reproduce

Install the package in any project

Details

The NuGet package built by this repo is laid out with the logger dll in 4 directories:

LIB
├───net462
│       GitHubActionsTestLogger.dll
│
├───net8.0
│       GitHubActionsTestLogger.dll
│
├───netstandard2.0
│       GitHubActionsTestLogger.dll
│
└───netstandard2.1
        GitHubActionsTestLogger.dll

By shipping these under lib, you're doing a few things:

  1. Ensure that the dll is copied to the output directory.
  2. Sending the DLL to the C# compiler as an assembly reference.
  3. Forcing you to ship the DLL 4 times, although there are only 2 test host runtimes you need to support (.NET Framework and .NET).

I'm guessing only the first of these are intended.
The third one is semi-useful because you want to support either runtime.

Proposed: Add the following four files to your package:

ref/net462/_._
ref/net8.0/_._
ref/netstandard2.0/_._
ref/netstandard2.1/_._

This is the conventional way in nuget to provide explicit reference assemblies in a package that should be presented to the compiler instead of those found under lib/. And in particular, the _._ notation doesn't end with .dll, so they won't be provided to the compiler.
So in effect, this stops the GitHubActionsTestLogger.dll from being sent as a reference assembly while still providing a target framework-based build of your dll for copying to the output folder.

Checklist

  • I have looked through existing issues to make sure that this bug has not been reported before
  • I have provided a descriptive title for this issue
  • I have made sure that this bug is reproducible on the latest version of the package
  • I have provided all the information needed to reproduce this bug as efficiently as possible
  • I have sponsored this project
@AArnott AArnott added the bug Something isn't working label Dec 13, 2024
@AArnott
Copy link
Author

AArnott commented Dec 13, 2024

As a workaround, I can reference the existing package like so:

<PackageReference Include="GitHubActionsTestLogger" IncludeAssets="runtime" />

And that effectively copies the right DLL for test time but without adding it as a reference assembly to my test project.

@Tyrrrz Tyrrrz added the help wanted Extra attention is needed label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants