0

我已经在这个主题上进行了很多搜索,但大多数答案都已经很老了,虽然我已经尝试过了,但它们对我不起作用。

我有一个 Avalonia 项目,当我构建它的调试或发布版本时,它按预期工作。该项目引用了其他一些项目,也是 Avalonia,它在根构建文件夹中构建了很多 dll(下图)。

解决方案资源管理器的屏幕截图

构建文件夹的屏幕截图(发布)

build 文件夹中有 48 个不同的 dll,我想将 dll 移动到单独的文件夹中。为此,我app.config在项目中创建了一个文件(默认情况下没有文件)并在其中添加了以下代码。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <probing privatePath="lib"/>
    </assemblyBinding>
 </runtime>
</configuration>

同样在后记中,我添加了这段代码以将 dll、xmls 和 pdbs 移动到 root/lib 文件夹:

:: Moves files to a subdirectory, to unclutter the application folder
:: Note that the new subdirectory should be probed so the dlls can be found.
SET path=$(TargetDir)\lib
if not exist "%path%" mkdir "%path%"
mklink /d %path%
del /S /Q "%path%"
move /Y $(TargetDir)*.dll "%path%"
move /Y $(TargetDir)*.xml "%path%"
move /Y $(TargetDir)*.pdb "%path%"

移动功能发生并且构建完成,但是当我尝试打开应用程序时,它没有给我任何出现问题的迹象,只是没有打开。在调试启动中,我在构建控制台中收到此错误:

The target process exited without raising a CoreCLR started event. Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core.
The program '[23508] PALauncher.exe' has exited with code -2147450726 (0x8000809a).

我将其解释为应用程序无法读取 dll。我不明白我做错了什么。任何帮助将不胜感激。

为伟大的长职位道歉。但我想让我的问题尽可能清楚。

4

0 回答 0