Skip to content

Generated .deps.json for a resolved package should use path relative to published app layout instead of NuGet package layout #48406

Open
@elinor-fung

Description

@elinor-fung

Describe the bug

When building/publishing an app with package references, the generated .deps.json contains the package assets with paths based on the NuGet package layout. However, the actual built/published app does not use those paths. The assets are directly in the output directory (or a culture-specific sub-directory for resource assemblies).

The fact that this works is actually relying on a bug in the host: dotnet/runtime#3525

Fixing this (and then the bug in the host) is necessary for any scenario for customizing the published layout - for example, for self-contained runtime location or shared libraries experience:

To Reproduce

  1. Add a PackageReference in a csproj:
    <ItemGroup>
      <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    </ItemGroup>
  2. Build/publish and inspect the generated .deps.json:
    "Newtonsoft.Json/13.0.3": {
      "runtime": {
        "lib/net6.0/Newtonsoft.Json.dll": {
          "assemblyVersion": "13.0.0.0",
          "fileVersion": "13.0.3.27908"
        }
      }
    }
  3. Compare to the published app layout. The dependency is at <output_directory>/Newtonsoft.Json.dll, not <output_directory>/lib/net6.0/Newtonsoft.Json.dll, as the .deps.json indicates.

Exceptions (if any)

None

Further technical details

On latest .NET 10 builds

cc @dotnet/appmodel

Metadata

Metadata

Assignees

Labels

Area-NetSDKbreaking-changeUsing this label will notify dotnet/compat and trigger a request to file a compat bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions