0

I have searched quite a lot on this subject but most of the answers are pretty old and while I've tried them, they do not work for me.

I have an Avalonia project that I made which is working as intended when I build either debug or release version of it. The Project references a few other projects and also being Avalonia, it builds a lot of dlls in the root build folder (Pictures below).

Screenshot of the Solution Explorer

Screenshot of the Build Folder (Release)

The build folder has 48 different dlls in there and I want to move the dlls in a separate folder. To that end, I created an app.config file in the project (There wasn't one by default) and added the below code in there.

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

Also in the postscript, I added this bit of code to move the dlls, xmls and pdbs to the root/lib folder:

:: 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 move function happens and the build gets completed but when I try to open the application, It does not give me any indication of something is going wrong and just does not open. In debug launch, I get this error in the build console:

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).

Which I interpreted as the application not being able to read the dlls. I do not understand what I am doing wrong. Any help would be greatly appreciated.

Apologies for the great long post. But I wanted to make my problem as clear as possible.

riQQ
  • 6,571
  • 4
  • 32
  • 48
  • There is no `PrivatePath` yet for .NET Core and .NET 5+, see https://stackoverflow.com/questions/56844233/additional-probing-paths-for-net-core-3-migration – riQQ Mar 26 '22 at 10:53

0 Answers0