Skip to content

Relative path in deps.json is ignored for assemblies from the app #3525

@vitek-karas

Description

@vitek-karas

The .deps.json can specify relative path for any asset. The directory portion of that path is ignored for normal assemblies which are part of the app though.

Repro:

dotnet new console
dotnet add package Newtonsoft.Json
dotnet build

Now in the bin/Debug/netcoreapp3.0 create a sub directory and move the Newtonsoft.Json.dll into it.
Edit the app.deps.json to point to sub/Newtonsoft.Json.dll like this:

{
  "runtimeTarget": {
    "name": ".NETCoreApp,Version=v3.0",
    "signature": "6596ed3d155c0211dab1fd90ba9d71b725c973ba"
  },
  "compilationOptions": {},
  "targets": {
    ".NETCoreApp,Version=v3.0": {
      "Newtonsoft.Json/12.0.1": {
        "runtime": {
          "sub/Newtonsoft.Json.dll": {
          }

Run the app via dotnet app.dll.

Expected:
The host should be able to find the Newtonsoft.Json.dll since it exists in the right relative path.

Actual:
The host fails to find the file, and it fails with error like this:

Error:
  An assembly specified in the application dependencies manifest (app.deps.json) was not found:
    package: 'Newtonsoft.Json', version: '12.0.1'
    path: 'sub/Newtonsoft.Json.dll'

Which is very misleading, as the path contains the subdirectory, but the host doesn't use it to look up the file. This can be observed in the trace:

Processing TPA for deps entry [Newtonsoft.Json, 12.0.1, sub/Newtonsoft.Json.dll]
  Considering entry [Newtonsoft.Json/12.0.1/sub/Newtonsoft.Json.dll], probe dir [], probe fx level:0, entry fx level:0
    Local path query did not exist F:\AppModel\repro\DepsJsonRelative\bin\Debug\netcoreapp3.0\Newtonsoft.Json.dll

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Hostin-prThere is an active PR which will close this issue when it is merged

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions