# Creating a FlatRedBall Project

### Introduction

This tutorial walks you through installing and creating an empty FlatRedBall project.

### Creating a New Project Without FlatRedBall Editor

If you would like to avoid using the FlatRedBall Editor completely, or if you are running on Linux or Mac, then you can directly download a project template .zip file. To do this:

1. Go to <https://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/>
2. Select your target platform. For example, if developing for desktop select <https://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallDesktopGlNet6Template.zip>
3. Download and unzip the file to your machine
4. Open the .sln in Visual Studio or Visual Studio Code (see below for Visual Studio Code instructions)

#### Using FlatRedBall with Visual Studio Code

Visual Studio is not a requirement for using FlatRedBall. You can write, compile, and run FlatRedBall projects using Visual Studio code. To do so:

1. Install Visual Studio Code
2. Install Visual Studio Code C# Dev Kit <https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit&ssr=false#overview>
3. Make sure you have .NET SDK 6 installed. If you are targeting iOS, Android, or Web then you must have .NET 8 SDK installed.

Open the folder where the .sln is located for your project.

![](/files/ixw3VMKYRqg0ww4lOP2u)

Select the folder where you have unzipped your project earlier.

![](/files/Q1YMmGkF63YLLIBJUKyL)

If asked, check **Yes, I trust the authors**.

![](/files/7TvEjYC3jO0UB4mhsDSj)

### Alternative - Adding FlatRedBall to your MonoGame Project

If you have an existing MonoGame project, you can add FlatRedBall with the following steps:

1. Open your MonoGame project in Visual Studio
2. Add FlatRedBall reference to your project
   1. If targeting Desktop GL, you can add FlatRedBall through the FlatRedBall NuGet package\\

      <figure><img src="/files/UuG9Rl7ECakxixZxqQim" alt=""><figcaption><p>FlatRedBall DesktopGL NuGet Package</p></figcaption></figure>
   2. If targeting other platforms, you will need to manually add the FlatRedBall .dlls to your project:
      1. Download the .dll for the project you are working on from this folder: <https://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/SingleDlls/>
      2. Save the .dll to a location relative to your project, such as a Libraries folder
      3. Link your game project to the newly-downloaded .dll
3. Modify `Game1` so it contains the following calls:

In Initialize before `base.Initialize()`:

```csharp
FlatRedBallServices.InitializeFlatRedBall(this, _graphics);
```

In Update before `base.Update(gameTime)`:

```csharp
FlatRedBallServices.Update(gameTime);
// Optional if you plan on using Screens:
ScreenManager.Activity();
```

In Draw before `base.Draw(gameTime)`:

```csharp
FlatRedBallServices.Draw();
```

FlatRedBall requires a shader file for rendering. You need to add this to your project. To do this:

1. Download the compiled shader XNB file from: <https://github.com/vchelaru/FlatRedBall/blob/NetStandard/Templates/FlatRedBallDesktopGlNet6Template/FlatRedBallDesktopGlNet6Template/Content/shader.xnb>
2. Save this to your Content folder in your project
3. Add this file to your Visual Studio project (.csproj)
4. Mark the file as **Copy if newer**

<figure><img src="/files/4XSFr0vnZgXqTkHD7QEj" alt=""><figcaption><p>shader.xnb set to Copy if newer</p></figcaption></figure>

### Running Your FlatRedBall Project With Visual Studio

To run your newly-created project:

1. Double-click the .sln file to open it in Visual Studio
2. Once your project opens, click the **Start** button in Visual Studio

<figure><img src="/files/qnzaQVNB3vYijDVBNpqT" alt=""><figcaption></figcaption></figure>

Your project should compile and run, displaying an empty (black) screen.

![Empty FlatRedBall game showing an empty black screen](/files/1RWJyEGDxj0zSDpfoaLH)

### Running your Project Without Visual Studio

If you would like to run your project without Visual Studio, you can use the dotnet build command line, but you must first install the .NET 6 SDK. <https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-6.0.308-windows-x64-installer> Once you have installed it, you can run the dotnet command to build your project. To build your project

1. Open a command window (like Windows PowerShell)
2. Go to the folder where your .sln is located
3. Type the command `dotnet build YourSolutionFile.sln`

This should produce a .exe which you can then run.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/flatredball/tutorials/code-only-project-tutorial/01-creating-a-flatredball-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
