nulastudio / NetBeauty2

Move a .NET Framework/.NET Core app runtime components and dependencies into a sub-directory and make it beauty.
MIT License
419 stars 21 forks source link

Manually loaded unmanaged dlls can't be found #7

Closed Ellpeck closed 4 years ago

Ellpeck commented 4 years ago

I'm using the MonoGame Framework for a project that I am trying to package with NetCoreBeauty. MonoGame loads its unmanaged dependencies (namely SDL) in an odd way, as seen here.

When running NetCoreBeauty on a simple example project and trying to run it, the SDL2.dll native library can't be found anymore. Moving that file from the runtimes folder to the main folder manually fixes the issue.

Here is a simple example project that you can use to recreate the issue: MLEMDesktopGLCoreTest.zip (When run successfully, this project simply displays a window with a black background.)

liesauer commented 4 years ago

you are right, any dlls that be loaded by DllImport cannot be moved. but unfortunately, NetCoreBeauty cannot determine whether a dll is manually loaded or not. i think the only way to solve this problem is that provide a BeautyExcludes property to exclude dlls that you don't want to be moved or can not be moved. a fix will be available soon.

Ellpeck commented 4 years ago

That sounds like a pretty good solution. Thanks!

liesauer commented 4 years ago

adding <BeautyExcludes>SDL2*;libSDL2*;sdl2*</BeautyExcludes> into csproj file to avoid moving SDL2. reference: https://github.com/MonoGame/MonoGame/blob/3b0df35ce1c73435f48953ccd2bb1a8b72c507be/MonoGame.Framework/Platform/SDL/SDL2.cs#L16-L26

liesauer commented 4 years ago

UPDATE: after viewing the changes of commit 633b952099, adding openal too for safe. <BeautyExcludes>SDL2*;libSDL2*;sdl2*;soft_oal*;openal*</BeautyExcludes>