Visual Studio C# Setup - raysan5/raylib GitHub Wiki
Setting up raylib in Visual Studio is very simple.
- Download and install Visual Studio (note, if you have used unity in the past, you probably have this already)
- Create a new C# Console Application Project from the File -> New -> Project Menu
- Select .net Core 3.1 for your target framework
- If you do not have .net Core 3.1 download an install it.
- After the project is created, Right click on the project and choose "managed nuget projects"
- Choose the Browse tab and type in "Raylib".
- Select the "raylib-cs" package from the list and choose 'install' from the panel on the right.
- Build your raylib game in C# by using the Raylib_cs library.
A simple main program looks like this
using System;
using Raylib_cs;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
Raylib.InitWindow(800, 600, "TEST");
while (!Raylib.WindowShouldClose())
{
Raylib.BeginDrawing();
Raylib.ClearBackground(Color.RAYWHITE);
Raylib.DrawText("Hello C# Window", 10, 10, 20, Color.RED);
Raylib.EndDrawing();
}
Raylib.CloseWindow();
}
}
}