Setup Project with C# .NET Core, SFML, and Visual Studio Code

In this post, we going to install SFML which the one for .NET Core. After the easy setup, we will create a window to check if it works.

Firstly, let's create a project folder that will contain our project files. I created a folder called Shmup, for now, you can give any name you want. After that open windows command line(cmd) in this project folder and type this command below:

code .
After that command, VS Code will be opened on your screen for the project directory. If you haven't installed .NET Core SDK on your computer, you should install it. Let's create our solution as first:
dotnet new sln -n "shmup"
You should have to get feedback The template "Solution File" was created successfully. Now we will create a console application:
dotnet new console -n "shmup"
At the end of these operations, the project folder should be seen as the following image:
Setup Project with VS Code and .NET
It's cool. Let's declare the console project to the solution because the solution has no information about the console application:
dotnet sln shmup.sln add ./shmup/shmup.csproj
We added a console application to shmup solution successfully. It's time to install SFML to our project. We can easily install SFML as a package. Firstly you should move in shmup console application folder using command line:
cd shmup
And after, add this SMLF package to the our project:
dotnet add package SFML.Net --version 2.5.0
After this installation, your shmup.csproj file should be like below:
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe<OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="SFML.Net" Version="2.5.0" />
  </ItemGroup>

</Project>
Now, we can use SFML as a library for our project. Finally, let's enter this command in command line to run the console application:
dotnet run
After this operation the project should look like it:
SFML Installation to C#
 Let's create our first window in the next article.

No comments:

Post a Comment