Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error first project  (Read 5393 times)

0 Members and 1 Guest are viewing this topic.

TheYoungGeek43

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Error first project
« on: August 24, 2018, 06:51:27 pm »
Hello,
I begin use SFML with C# and I've see a youtube video for display window but I have a error
(I use Rider)

This is the error

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'sfmlnet-graphics-2, Versio
n=2.2.0.0, Culture=neutral, PublicKeyToken=null'. Tentative de chargement d'un programme de format incorrect.
   at French_Master_Game_Jam_1.Program.Main(String[] args)



 

MyCode
Program.cs
using System;

namespace FrenchMasterGameJam1
{
    class Program
    {
        static void Main(string[] args)
        {
            RPG game = new RPG();
            game.Run();
        }
    }
}

Game.cs

using SFML.Graphics;
using SFML.Window;

namespace FrenchMasterGameJam1
{
    public abstract class Game
    {
        protected RenderWindow window;
        protected Color clearColor;
       
        public Game(uint width, uint height, string title, Color clearColor)
        {
            this.window = new RenderWindow(new VideoMode(width, height), title, Styles.Close);
            this.clearColor = clearColor;
        }

        public void Run()
        {
            LoadContent();
            Initialize();
            while (this.window.IsOpen)
            {
                this.window.DispatchEvents();
                Update();
                this.window.Clear(clearColor);
                Render();
                this.window.Display();
            }
        }

        protected abstract void LoadContent();
        protected abstract void Initialize();

        protected abstract void Update();
        protected abstract void Render();
    }
}
 

Main.cs

using SFML.Graphics;

namespace FrenchMasterGameJam1
{
    public class RPG : Game
    {
        public RPG() : base(600, 800, "Test", Color.Blue)
        {
           
        }

       
        protected override void Initialize()
        {
        }
       
        protected override void LoadContent()
        {
        }

        protected override void Update()
        {
        }

        protected override void Render()
        {
        }
    }
}
 

I have look all dll (SFML) is copied in the debug directory

Thanks for help
L'échec est la preuve que l'on à essayer

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: Error first project
« Reply #1 on: August 25, 2018, 06:33:02 pm »
Make sure you have all dlls SFML.NET depends on as well - CSFML, SFML, openal, etc.

TheYoungGeek43

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: Error first project
« Reply #2 on: August 25, 2018, 09:46:06 pm »
I've test this moorning and i forget the c dll (csfml) ^^ thx
L'échec est la preuve que l'on à essayer