0

I'm trying to set up my application's config file so that it will use the libraries from a specific directory depending on what OS it's on. It sounds really simple, but I've been at it for hours trying all different kinds of configurations and searching online for the answer.

My application uses some native DLLs in a directory named after the OS it's running on (in my case, the "win" directory, but I plan on making "linux" and "osx" directories for the binaries for them too), and in the directory holding those directories are .NET DLLs that have bindings to those DLLs. So, the full layout of the project is the root folder, a "lib" folder with the .NET bindings, and the directories for the OS-specific DLLs.

And, if it helps, to be specific, I'm using SFML with the SFML.Net binding.

So far, I've tried adding *.dll.config files for every (all four) .NET DLLs, as well as simply adding the config to the main *.exe.config file. This is one of my config files, but I've tried a dozen variations of it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <probing privatePath="lib;lib\win" />
        </assemblyBinding>
    </runtime>
    <dllmap os="windows" dll="csfml-system-2" target="\lib\win\csfml-system-2.dll"/>
    <dllmap os="windows" dll="csfml-graphics-2" target="\lib\win\csfml-graphics-2.dll"/>
    <dllmap os="windows" dll="csfml-window-2" target="\lib\win\csfml-window-2.dll"/>
    <dllmap os="windows" dll="csfml-audio-2" target="\lib\win\csfml-audio-2.dll"/>
    <dllmap os="linux" dll="csfml-system-2" target="libcsfml-system.so.2.2"/>
    <dllmap os="linux" dll="csfml-graphics-2" target="libcsfml-graphics.so.2.2"/>
    <dllmap os="linux" dll="csfml-window-2" target="libcsfml-window.so.2.2"/>
    <dllmap os="linux" dll="csfml-audio-2" target="libcsfml-audio.so.2.2"/>
</configuration>

I'm not using any IDE, I'm writing the configs myself in my own editor of choice. Thank you for your time.

4
  • I don't think it is practical to deploy other OS stuffs. If u deploying this for Win, u shouldn't include other OS stuffs, it's not like u can simply switching your OS and run the same stuffs on same location. My point is the feature is impractical, no point delve in it.
    – Kelmen
    Commented Nov 3, 2015 at 3:41
  • Actually it's most of the reason I'm using .NET. And yes, a .NET application with all the required DLLs will run on every OS it has those DLLs for. I already can do this now, but I would rather keep everything tidy in it's own directories instead of one big directory for every DLL.
    – Konata
    Commented Nov 3, 2015 at 3:47
  • what's the point for deploying other os dlls, when the app will never used them? u can keep using a specific folder for a os dlls, but may as well skip the other os dlls, as they will never be used, and it's not like u can simply copy from windows and paste it to mac and run it, u still need a os dependent compilation for it.
    – Kelmen
    Commented Nov 3, 2015 at 4:00
  • Okay so besides wasting my time with your broken english by giving me false hope in thinking a legitimate SO user actually attempted to help me by making my inbox light up, you apparently don't even understand how .NET works. See, if I make a .NET application, and put Windows and OS X dynamic link libraries in it's "lib" folder, that single application will work on both Windows and OS X. I'm not excluding other OSes from my project.
    – Konata
    Commented Nov 3, 2015 at 4:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.