SFML / SFML.Net

Official binding of SFML for .Net languages

Home Page:https://www.sfml-dev.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SFML.net from Nuget doesn't seem to work with .net framework 4.7.2

SonOfDiablo opened this issue · comments

I just installed the nuget package for SFML.net in a fresh .net framework 4.7.2 console project.

My code is super simple right now:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.Graphics;

namespace SFMLTest
{
    class Program
    {
        static void Main(string[] args)
        {
            SFML.Graphics.RenderWindow renderWindow = new RenderWindow(new SFML.Window.VideoMode(800, 600), "SFML Test");
        }
    }
}

I have copied csfml-Audio.dll, csfml-Graphics.dll, csfml-System.dll, csfml-Window.dll and openal32.dll to the output folder and yet I still get the following error message:

System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)'

Am I just being incredibly stupid or is something wrong here?

We highly recommend to use .NET Core, as there are some issues (#174) with .NET framework and native libraries.

As for your description, it seems like a mismatch between architecture or library versions.
Where did you get the DLLs from?
For what architecture are you build your .NET application?

Thanks for the response!
It seems that "Prefer 32 bit" is ticked on by default for some reason, unticking that in Project > Properties > Build seems to fix the issue :)

I got the DLLs from the nuget package under CSFML.2.5.0\runtimes\win-x64.

Okay, yeah if you want to build for 32-bits, you'd have to take the x86 ones. 😉

Unless, you have anything else, I'll close this issue then.