Confluent-kafka-dotnet: “librdkafka.redist” build warning of .net standard 2.0 project.

Created on 12 Aug 2017  ·  10Comments  ·  Source: confluentinc/confluent-kafka-dotnet

Build warning of .net standard 2.0 project.

Environment: Visual Studio 2017 Preview (15.3)

warning NU1701: Package 'librdkafka.redist 0.11.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

bug

Most helpful comment

To explain what happens:

  • as librdkafka.redist has no target framework (normal, it's native, not managed), in .netstandard2.0, it assumes it loads it as a net461 and provide some warning. This is the case for all nuget which doesn't have a netstandard reference.
  • in our case, there is no managed dll, so it changes nothing (we just copy the runtimes folder). I just wonder if it could copy the x64/x86 in some cases where we don't need it (but it's already the case sometimes, it doesn' seem to be the case in my tests)

Except this, there is no downside at runtime. Adding NoWarn="NU1701" in the package reference in Confluent.Kafka remove the warnings (this is the way to go, see end of https://github.com/NuGet/Home/wiki/Improved-NuGet-warnings)

Edit: for current time, NoWarn should be added to librdkafka.redist which should be explicitly referenced to remove this warning actually, this is not transitive
(see https://github.com/NuGet/Home/wiki/%5BSpec%5D-Transitive-Warning-Properties)

All 10 comments

looks like we need to tweak something in the librdkafka.redist nuget package for the upcoming .net standard 2.0 @edenhill

To explain what happens:

  • as librdkafka.redist has no target framework (normal, it's native, not managed), in .netstandard2.0, it assumes it loads it as a net461 and provide some warning. This is the case for all nuget which doesn't have a netstandard reference.
  • in our case, there is no managed dll, so it changes nothing (we just copy the runtimes folder). I just wonder if it could copy the x64/x86 in some cases where we don't need it (but it's already the case sometimes, it doesn' seem to be the case in my tests)

Except this, there is no downside at runtime. Adding NoWarn="NU1701" in the package reference in Confluent.Kafka remove the warnings (this is the way to go, see end of https://github.com/NuGet/Home/wiki/Improved-NuGet-warnings)

Edit: for current time, NoWarn should be added to librdkafka.redist which should be explicitly referenced to remove this warning actually, this is not transitive
(see https://github.com/NuGet/Home/wiki/%5BSpec%5D-Transitive-Warning-Properties)

@edenhill @treziac Another way to solve this without disabling the warning:

  1. Move librdkafka.redist.props to /build (adjusting paths in the file)
  2. Delete /build/net

In /build with no TFM, the props file will apply everywhere--which should be fine because it's already the same in all cases--and NuGet won't warn NU1701 in a .NET Core/Standard project.

Just curious to know if you were going to try @chlowell solution. We have this library inside another custom Nuget package in our company, which is then used in 20+ projects. So we get yellow warnings all over the place (and the NoWarn fix doesn't work because it's not transitive as you pointed out). Thx!

thanks @chlowell - i'll experiment with this now.

Also following up - we are in the same situation as @mbirnios.

@chlowell's suggestion is incorporated in #355, and should be in the release we're targeting for 20th Nov.

Great thanks @mhowlett!

@mhowlett Is the 20th Nov release changes are available to use?

@SuchimayaMohanty - just uploaded it to nuget.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ietvijay picture ietvijay  ·  3Comments

keggster101020 picture keggster101020  ·  4Comments

kvandake picture kvandake  ·  3Comments

alfhv picture alfhv  ·  3Comments

michael-huxtable picture michael-huxtable  ·  4Comments