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

Nuget dependency chaining causing unwanted dependency on Fody #94

Open
twaddell opened this issue Oct 23, 2019 · 2 comments
Open

Nuget dependency chaining causing unwanted dependency on Fody #94

twaddell opened this issue Oct 23, 2019 · 2 comments

Comments

@twaddell
Copy link
Contributor

I am building a dll project into a Nuget package. This dll project references the Tracer.4NLog.Fody package for it's logging.

If I include my Nuget package in a project an unwanted reference to Fody is included and I'm having to include FodyWeaver.xml etc. in every project that uses my package.

This seems unnecessary to me as Fody is only needed at compile time in the original dll project and I don't believe it should be required in projects referencing my Nuget package.

I have tried setting the compile time references to be PrivateAssets as follows:

<PackageReference Include="Tracer.4NLog.Fody" Version="3.2.0">
  <PrivateAssets>build; native; contentfiles; analyzers</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>

but there is still a dependency on Fody.

I think essentially I am looking for a way to reference the Tracer.NLog.dll without also referencing Fody.

@csnemes
Copy link
Owner

csnemes commented Dec 7, 2019

In order to use Tracer.4NLog.Fody properly the assembly referencing it should be rewritten. So I cant see exactly how you can use the Tracer library without using Fody.

@twaddell
Copy link
Contributor Author

I agree that a Fody reference is needed for the project immediately referencing Tracer.4NLog.Fody but the dependency on Fody continues up the project chain.
For example, we are creating MyLibrary and want to include tracing functionality for the library so add the Nuget package for Tracer.4NLog.Fody. MyLibrary now includes Fody because of the following dependency chain.
MyLibrary -> Tracer.4NLog.Fody -> Fody

However the reference to Fody is not set as PrivateAssets so when MyApp references MyLibrary it now also has an unnecessary dependency on Fody
MyApp -> MyLibrary -> Tracer.4NLog.Fody -> Fody

Is there a way to set the dependency on Fody to not keep passing up the dependecy chain? Or do I need to set an explicit reference to Fody in MyLibrary with PrivateAssets set?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants