Skip to content

Commit 2996cfb

Browse files
Merge pull request #46 from AristurtleDev/update-version
Adds documentation for Updateing MonoGame
2 parents 0a9aed2 + 63bcee6 commit 2996cfb

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: Updating Versions
3+
description: A guide on updating MonoGame when a new release is pushed.
4+
---
5+
6+
7+
- [Update Existing Projects](#update-existing-projects)
8+
- [Update Target Framework](#update-target-framework)
9+
- [Update NuGet References](#update-nuget-references)
10+
- [Visual Studio 2022](#visual-studio-2022)
11+
- [Manually Editing .csproj File (VSCode/Rider)](#manually-editing-csproj-file-vscoderider)
12+
- [Update MGCB Editor](#update-mgcb-editor)
13+
- [Updating Environment for New Projects](#updating-environment-for-new-projects)
14+
- [Update dotnet Templates](#update-dotnet-templates)
15+
- [Visual Studio 2022](#visual-studio-2022-1)
16+
- [dotnet CLI (VSCode/Rider)](#dotnet-cli-vscoderider)
17+
18+
When a new release of MonoGame is pushed, developers will need to manually update their development environment and/or existing project to make use of the new version. This guide is intended to walk you through the steps of performing these updates.
19+
20+
## Update Existing Projects
21+
Developers wishing to update their current project to use a new release version only need to update the *target framework*, *NuGet package verions*, and *dotnet tools* version. Doing this dpeends on if you are using Visual Studio 2022 or another development environment.
22+
23+
### Update Target Framework
24+
Developers will need to ensure the project is updated to target the .NET version used by MonoGame at minimum (currenty `net8.0`). To do this, open your project's *.csproj* file and find the `<TargetFramework>` element and change the `net-X.Y` version to `net-8.0`, then save the file.
25+
26+
> [!NOTE]
27+
> Only change the .NET version number. some projext types have platform specifiers such as `net6.0-windows`. The only thing that should change here is the version number.
28+
29+
### Update NuGet References
30+
The following sections cover updating your NuGet packages for existing projects based om your developmemt environment.
31+
32+
#### Visual Studio 2022
33+
Open your existing project in Visual Studio 2022 and perform the following
34+
1. Right-click on the project in the *Solution Explorer* panel and select *Manage NuGet Packages...".
35+
2. In the NuGet Packages Manager window, click the *Updates* tab.
36+
3. Select the MonoGame Framework packages in the list on the left, then click the *Update* button for each one on the right.
37+
38+
#### Manually Editing .csproj File (VSCode/Rider)
39+
Alternatively, regardless of the development environment, developers can manually edit the *.csproj* file for their project to update to the newest MonoGame release. To do this
40+
1. Open your project's *.csproj* file
41+
2. Locate the `<PacakgeReference>` elements for any MonoGame referenced packages.
42+
3. Change the `Version=` attribute for each one to the current version of MonoGame (currently this is `3.8.2.1105`)
43+
4. Save the *.csproj* file.
44+
45+
Once these changes are made, open a command prompt or terminal at the root of the project directory and enter the following commands
46+
47+
```sh
48+
dotnet clean
49+
dotnet restore
50+
```
51+
52+
### Update MGCB Editor
53+
Regardless of the development environment, users will need to update the dotnet tools manifest file manually to use the newest version of the *MonoGame Content Builder*. To do this:
54+
1. Open the *.config/dotnet-tools.json* manifest file located in the project root directory
55+
2. Update the version specified for each tool to the current version of MonoGame (currently this is `3.8.2.1105`).
56+
3. Save the changes
57+
58+
Once these changes are made, open a command prompt or terminal at the root of the project directory and enter the following commands
59+
60+
```sh
61+
dotnet tool restore
62+
```
63+
64+
## Updating Environment for New Projects
65+
The following sections will cover updating your development environment for new projects.
66+
67+
### Update dotnet Templates
68+
Developers will need to update the MonoGame C# Templates used to create new projects. Doing this depends on if you are using Visual Studio 2022 or through the dotnet cli.
69+
70+
> [!NOTE]
71+
> Updating the templates will not affect existing projects. if developers wish to update existing project, see the info in the [Update Existing Projects](#update-existing-projects) section.
72+
73+
#### Visual Studio 2022
74+
Developers using Visual Studio 2022 should be using the [MonoGame C# Project Templates](https://marketplace.visualstudio.com/items?itemName=MonoGame.MonoGame-Templates-VSExtension) extension. This provides not only the tempaltes but also the functinality to open the *MonoGame Content Builder Editor* (MGCB Editor) within Visual Studio. You can update the extension by performing the following
75+
76+
1. Open Visual Studio 2022
77+
2. In the lanuch window, choose the *Continue without code* option at the bottom on the right.
78+
3. From the top menu choose, *Extensions > Manage Extensions* to open the *Extension Manager* panel.
79+
4. Click the *Updates* tab and choose *MonoGame Framework C# project templates* and update it to the latest version.
80+
81+
If prompted to close Visual Studio to finish the update, do so now to continue installing the update.
82+
83+
#### dotnet CLI (VSCode/Rider)
84+
Develoeprs using the dotnet CLI with environments such as Visual Studio Code, JetBrains Rider, or other editors, can exceute the following command in a command prompt/terminal to update the templates
85+
86+
```sh
87+
dotnet new install MonoGame.Templates.CSharp
88+
```
89+
90+
> [!TIP]
91+
> If you receive a an error or warning stating there are naming conflicts in the templates, you may need to uninstall the templates first with the following command and then install them:
92+
>
93+
> ```sh
94+
> dotnet new uninstall MonoGame.Templates.CSharp
95+
> ```
96+
97+
Alternatively, you can perform `dotnet new update` which will update all templates installed to their most current version avaialble. However, this may affect other templates you have installed that you may not wish to update, it's an all or nothing command.

articles/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@
9797
href: migration/migrate_37.md
9898
- name: Migrating from 3.8.0
9999
href: migration/migrate_38.md
100+
- name: Updating Versions
101+
href: migration/updating_versions.md
100102
- name: Samples and Demos
101103
href: samples.md
102104
- name: Community Tutorials

0 commit comments

Comments
 (0)