C
C#2y ago
Costin

❔ Make package C private in project A, which inherits project B which uses package C

I have 2 projects, project A and B. project A inherits project B (dependency). however, I want project A to not be able to see project B's NuGet package.
3 Replies
Costin
CostinOP2y ago
I have tried doing the following in project B's config (PrivateAssets = "All"):
<ItemGroup>
<PackageReference Include="SFML.Net" Version="2.5.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SFML.Net" Version="2.5.0" PrivateAssets="All" />
</ItemGroup>
however, it throws System.IO.FileNotFoundException: 'Could not load file or assembly exception, meaning that the package is not being placed with project A's build. I am (obviously) running from project A. Update: I replaced PrivateAssets="All" with PrivateAssets="compile". Is it a good solution?
Anton
Anton2y ago
There is more to it, there are these in addition to PrivateAssets, look up the documentation
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
chatgpt might be able to generate you a few examples, maybe just paste the documentation page to it and ask for examples
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server