AddProbingPaths not respected after publishing dotnet?

I am using dotnet 2.1.4 for windows. dotnet --info shows:

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.16299
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.1.4\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

I am using dotnet publishing to generate output for the platform:

dotnet publish ..\src\ChestnutDS.Host\ChestnutDS.Host.csproj
     -c Release -o ..\..\published\win-x64
     --self-contained -r win-x64 -v n

This gives me the desired (and working) output in a folder with 323 files.

published folder

Now, what I want to do is move all of the most files to a subfolder, like lib.

Moved most of the stuff into lib

From what I put together, the installation additionalProbingPathsin runtimeconfig.json should work:

{
  "runtimeOptions": {
    "additionalProbingPaths": [
      "lib"
    ]
  }
}

But he complains that he will not find the library:

Error:
  An assembly specified in the application dependencies manifest (ChestnutDS.Host.deps.json) was not found:
    package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.1'
    path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll'

Trying to pass --additionalProbingPath as a command line argument also does not work, same error.

Trying to create the specified structure and moving the file ( lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll) also does not work.

- ? ? , .

+8
2

, lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll targets/Microsoft.AspNetCore.Antiforgery/2.0.1/runtime "path": "microsoft.aspnetcore.antiforgery/2.0.1" libraies/Microsoft.AspNetCore.Antiforgery/2.0.1 libraies/Microsoft.AspNetCore.Antiforgery/2.0.1. <additional probing path>/Microsoft.AspNetCore.Antiforgery/2.0.1/lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll

, hostpolicy.dll (*.dll *.ni.dll):

  • ( , "" )
  • NuGet ( <PackageName>/<Version>/<DllPath> *.deps.json )

:

  • ( ) - , App.exe(App.dll); SCD.
  • Framework ( ) - Framework , C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.4\.
  • ( NuGet).

, App.deps.json ( )

"targets": {
    "runtime.win-x64.Microsoft.NETCore.App/2.0.0": {
        "runtime": {
              "foo/Microsoft.CSharp.dll": {},  // <========
        }
    }
}

"libraries": {
    "runtime.win-x64.Microsoft.NETCore.App/2.0.0": {
      "type": "package",
      "serviceable": true,
      "sha512": "sha512-8jivXDJLuJTxMQuInZaMiD2VbxehFmYAtn2V9mj9juaR5jH54/OBGmGv6SrIUVNqASXB/8dJbce/beIKnOzroQ==",
      "path": "bar", // <========
      "hashPath": "runtime.win-x64.microsoft.netcore.app.2.0.0.nupkg.sha512"
    }
}

, hostpolicy.dll - "runtime" "native" .

TPA (Trusted Platform Assemblies) . <app folder path>\Microsoft.CSharp.dll <app folder path>\Microsoft.CSharp.dll ( , "" ).

DLL , Additional Probing Paths , .

, Additional Probing Path NuGet, . , Package Name Version "libraries", "path" DLL "runtime" ( "native").

, Microsoft.CSharp.dll <Additional Probing Path>/bar/foo/Microsoft.CSharp.dll

0
0

Source: https://habr.com/ru/post/1693278/


All Articles