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

Support transitive package dependency of referenced (non-packing) project #199

Closed
khamza85 opened this issue Jul 9, 2022 · 1 comment · Fixed by #202
Closed

Support transitive package dependency of referenced (non-packing) project #199

khamza85 opened this issue Jul 9, 2022 · 1 comment · Fixed by #202
Labels
bug Something isn't working

Comments

@khamza85
Copy link

khamza85 commented Jul 9, 2022

Describe the Bug

Sorry if a similar question was submitted before. Couldn't find anything similar.

Packaging project Pkg with net472 TFM has a dependency on a project NetStandardLib with netstandard2.0 TFM. NetStandardLib has a package reference on say Serialize.Linq package. I'd like to use Pkg package from another net472 project and transitively depend on Serialize.Linq

Steps to Reproduce

NetStandardLib.zip

Run nugetize on Pkg. In the generated nuspec, I see

    <dependencies>
      <group targetFramework=".NETStandard2.0">
        <dependency id="Serialize.Linq" version="2.0.0" />
      </group>
      <group targetFramework=".NETFramework4.7.2" />
    </dependencies>

which makes Serialize.Linq package impossible to be transitive dependency if you refer Pkg package from another net472 project.

Expected Behavior

Not even sure. Maybe nuspec should be generated something like this:

    <dependencies>
      <group targetFramework=".NETStandard2.0">
        <dependency id="Serialize.Linq" version="2.0.0" />
      </group>
      <group targetFramework=".NETFramework4.7.2">
         <dependency id="Serialize.Linq" version="2.0.0" />
       </group>
    </dependencies>

Version Info

NuGetizer: v0.8.0

Additional Info

I'm okay with any proper alternative solution. The only walkaround I found is to change NetStandardLib TFM to net472 or multi-target it with net472 and netstandard2.0.

@khamza85 khamza85 added the bug Something isn't working label Jul 9, 2022
@kzu kzu changed the title Question on referencing netstandard2.0 project from netfx (472) packing project Support transitive package dependency of referenced (non-packing) project Jul 15, 2022
kzu added a commit that referenced this issue Jul 15, 2022
We were previously not re-targeting dependencies from referenced (non-packing) projects, which would end up as dependencies in the originating project TFM, instead of the packing (TFM-specific) project, causing a runtime failure since the dependency wouldn't be present, even if the referenced assembly would.

This is now supported, including in multi-targeting scenarios for the packing project.

Fixes #199
@kzu kzu closed this as completed in #202 Jul 15, 2022
kzu added a commit that referenced this issue Jul 15, 2022
We were previously not re-targeting dependencies from referenced (non-packing) projects, which would end up as dependencies in the originating project TFM, instead of the packing (TFM-specific) project, causing a runtime failure since the dependency wouldn't be present, even if the referenced assembly would.

This is now supported, including in multi-targeting scenarios for the packing project.

Fixes #199
@kzu
Copy link
Member

kzu commented Jul 15, 2022

Thanks for reporting this issue @khamza85! It was indeed a foresight on my part, and is now working properly across multiple transitive reference levels and multi-targeting 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants