How to get `dotnet` to tell me the actual dependencies contained in a self-contained package?

Michael Park 0 Reputation points
2023-11-09T19:58:07.7033333+00:00

Hello everyone. I am trying to understand the .deps.json file that dotnet publish creates. Where can I find more information about this?

If I make a random .net project that just contains the dependency DeepCloner and publishes to osx and target framework net6.0, the .deps.json file lists two versions of many of the runtime dependencies, such as:

...
"targets": {
  ".NETCoreApp,Version=v6.0": {},
  "NETCoreApp,Version=v6.0/osx-arm64": {
  "project/1.0.0":{...}, 
  "runtimepack.Microsoft.NETCore.App.Runtime.osx-arm64/6.0.16": { 
...
  < tons of depdencies, including System.Net.Http assembly version 6.0.0 >  
  },
...
  < but further down in this list we also see: >
  "System.Net.Http/4.3.0": {...},
...
  < as well as all the other "older" system dependencies that is not a part of net6.0 >
}
...	

But the published artifact only contains the .dll for System.Net.Http version 6.0.0 (which makes sense given the target framework)

So what's the deal with listing all those that for sure is not a part of the published artifact?

How can I somehow get a "true" list of dependencies related to my specific framework and RID?

Doing a dotnet list does not show this, only the literal dependencies in the tree, not the actual, resolved versions.

Thanks in advance.

Developer technologies | .NET | .NET Runtime
{count} votes

1 answer

Sort by: Most helpful
  1. Jiachen Li-MSFT 34,221 Reputation points Microsoft External Staff
    2023-11-10T02:09:50.6266667+00:00

    Hi @Michael Park ,

    Check if the following document helps.

    https://github.com/dotnet/cli/blob/rel/1.0.0/Documentation/specs/runtime-configuration-file.md

    Best Regards.

    Jiachen Li


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.