1

I'm creating a nuget package that uses refit as a dependency and when consuming the produced package I need to ensure refit gets installed as a top level package in the consuming project instead of a transitive reference. I'm using the new csproj file format to create the nuget package and currently referencing refit like this:

<ItemGroup>
    ...
    <PackageReference Include="Refit" Version="4.0.1" /> 
    ...
</ItemGroup>

Is there an attribute I can specify to make sure this gets added as a top-level package reference when my nuget package gets consumed?

JohnB
  • 117
  • 1
  • 5
  • This is not possible with a package only as NuGet, rightfully so, does not allow packages themselves to participate in the restore in ways that are not the nuspec. What are you trying to achieve here? Why does Refit need to be a top level package reference? You can consider making your distribution an SDK if it's more appropriate. Then you can add multiple PackageReference elements. https://github.com/Microsoft/MSBuildSdks – imps Jul 13 '18 at 17:01
  • Why do you want it to be a top-level reference? If it's about different asset types that are forwarded or not (analyzers, build logic), those can be controlled via metadata attributes on `PackageReference` – Martin Ullrich Jul 15 '18 at 20:55
  • If I leave refit as an transient reference, i.e. I don't add refit as a top level package, then my project fails to build. I am wondering if there is something to do with the asset type forwarding I can do, I'll take a look, thanks... – JohnB Jul 16 '18 at 15:25

0 Answers0