Skip to content

Microsoft.Extensions.Telemetry.Abstractions nuget package is missing the buildTransitive/netstandard2.0 folder #7416

@CZEMacLeod

Description

@CZEMacLeod

Description

The build and published nuget package supports net462, netstandard2.0, and the stanrdard net8.0, net9.0, and net 10.0 TFMs.
However, the package does not include the buildTransitive/netstandard2.0 folder and associated .targets file.
Using this on a class library targeting netstandard results in problems with conflicting source generators since the DisableMicrosoftExtensionsLoggingSourceGenerator property is not injected into the project.

Reproduction Steps

Create a netstandard2.0 class library.
Install Microsoft.Extensions.Telemetry.Abstractions
Try and use the LoggerMessageAttribute.
You will get an error about ambiguous methods and partial methods cannot have multiple implementations.

Expected behavior

You should be able to use LoggerMessageAttribute etc. to get the enhanced version of the source generator without conflicts.

Actual behavior

The original source generator from Microsoft.Extensions.Logging.Abstractions conflicts and you get error messages and it won't compile.

Regression?

This appears to be the case in all the packages I've looked at from 8.0.0 thru 10.4.0

Known Workarounds

You can manually add the missing property to the class library project.

Configuration

Not really applicable but a netstandard2.0 class using net10 sdk.

Other information

There is some code in the project file which I think is meant to make the build engine add the transitive file but it doesn't appear to work.

<PropertyGroup>
<_AdditionalNETStandardCompatErrorFileContents>
<![CDATA[
<!-- This package should replace the Microsoft.Extensions.Logging.Abstractions source generator, so we set the property to remove the source generator from the project. -->
<PropertyGroup>
<DisableMicrosoftExtensionsLoggingSourceGenerator>true</DisableMicrosoftExtensionsLoggingSourceGenerator>
</PropertyGroup>
]]>
</_AdditionalNETStandardCompatErrorFileContents>
</PropertyGroup>

The lib/netstandard2.0 folder exists and the dll is there.

https://nuget.info/packages/Microsoft.Extensions.Telemetry.Abstractions/10.4.0

There does seem to be some mixing of stuff in the .targets/.props files. There is no net9.0 or net10.0 buildTransitive folder either (I assume it falls back to the net8.0 version).
The net462 version has the property in the .targets file, not a .props file, and the target that removes the analyser is missing there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue describes a behavior which is not expected - a bug.needs-area-labeluntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions