Referencing MonoGame
Last updated
Last updated
Your project references MonoGame objects (in the Microsoft.Xna.Framework namespace), but you have compile errors.
These compile errors may be on using statements such as
If you are using MonoGame 3.8.1 or newer, then your game project must target .NET 6 or newer. Note that to use .NET 6, you must use Visual Studio 2022 or newer.
You can identify the version of your game by double-clicking the Project in Visual Studio, or by opening the .csproj in a text editor.
For example, the following project is targeting .NET Core 3.1:
Modify this version to .NET 6 by changing the TargetFramework version to net6.0-windows
or net6.0
if you plan on targeting other platforms.
For example, after the change the text may appear as shown in the following snippet:
Visual Studio shows errors about NuGet packages not existing in the source. You may see something about Microsoft Visual Studio Offline Packages.
Check the NuGet Package Sources:
If nuget.org is not listed, click the + button, set the name to nuget.org and set the source to https://api.nuget.org/v3/index.json
In Visual Studio, select Tools -> Options
Expand NuGet Package Manager and select Package Sources
Verify that nuget.org is in the list, and is checked