Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
SonOfDiablo opened this issue Dec 5, 2020 · 3 comments
Closed

Comments

@SonOfDiablo
Copy link

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?

@eXpl0it3r
Copy link
Member

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?

@SonOfDiablo
Copy link
Author

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.

@eXpl0it3r
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants