Skip to content

Commit 0c9a17c

Browse files
Finalize the 3.8.x upgrade guide
1 parent affa014 commit 0c9a17c

File tree

2 files changed

+38
-32
lines changed

2 files changed

+38
-32
lines changed

articles/migration/migrate_38.md

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,61 @@
11
---
2-
title: Upgrading MonoGame projects from 3.8.0 or later to 3.8.4.1
3-
description: A guide on upgrading a MonoGame v3.8 project to the current 3.8.4.1 + versions of MonoGame.
2+
title: Upgrading MonoGame from 3.8.x to latest
3+
description: A guide on upgrading a MonoGame v3.8 project to the current 3.8.4.1+ releases of MonoGame.
44
---
55

66
Upgrading existing projects from earlier 3.8 releases should be straightforward for most platforms.
77

8-
The major difference is that 3.8.4 onward recommends using .NET 9 in your client project (mandatory for Mobile projects by the DotNet Framework). You can follow the [environment setup tutorial](../getting_started/index.md) to make sure that you are not missing any components.
8+
> [!NOTE]
9+
> If you are migrating/upgrading from [XNA](./migrate_xna.md) or [MonoGame 3.7 or earlier](./migrate_37.md) then check the dedicated guides for those actions before returning here.
10+
11+
- The critical difference from pre 3.8.2 builds, [is that the MGCB Editor is no longer a global .NET tool](#addupdate-dotnet-toolsjson-configuration) and the MGCB editor is now included as part of the specific project through the use of the dotnet tooling configuration `dotnet-tools.json` file located in the `.config` folder in your solution/project.
12+
13+
- The major difference from 3.8.4 onwards is that we recommend using .NET 9 in your client project, but it is not mandatory, we are also simplifying the `csproj` configuration to reduce management for developers from 3.8.4.1.
14+
15+
> For iOS/Android however, DotNet 9 at a minimum is Mandatory, [see details here](#iosipados-and-android-considerations).
916
10-
The MGCB Editor is no longer a global .NET tool and the MGCB editor is included as part of the specific project through the use of the dotnet tooling configuration `dotnet-tools.json` file located in the `.config` folder in your solution/project.
17+
You can follow the [environment setup tutorial](../getting_started/index.md) to make sure that you are not missing any components.
1118

1219
> [!NOTE]
1320
> If you are using Visual Studio 2022, we recommend that you use the MonoGame extension which helps with accessing the MGCB editor without the need of CLI commands.
1421
1522
The process of updating your project should be fairly quick and painless without having to change your code or your content project.
1623

17-
> [!IMPORTANT]
18-
> It is also recommended that you uninstall the older global versions of the .NET tools as described below.
19-
2024
## Contents
2125

22-
- [Updating DotNet Target Framework](#updating-dotnet-target-framework)
26+
- [Updating DotNet Target Framework](#updating-the-dotnet-target-framework)
2327
- [Update MonoGame references](#update-monogame-references)
2428
- [Add/Update `dotnet-tools.json` Configuration](#addupdate-dotnet-toolsjson-configuration)
25-
- [Remove `RestoreDotnetTools` section from csproj](#remove-restoredotnettools-section-from-csproj)
29+
- [Remove `RestoreDotNetTools` section from csproj](#remove-restoredotnettools-section-from-csproj)
2630
- [iOS/iPadOS, and Android Considerations](#iosipados-and-android-considerations)
2731

28-
## Updating DotNet Target Framework
32+
## Updating the DotNet Target Framework
2933

30-
Modern MonoGame projects now use the DotNet framework (older project used to rely on the NetCore/NetFramework libraries). As MonoGame has used DotNet project templates since 3.8.x, you only need to replace the `TargetFramework` element of any `csproj` files referencing MonoGame libraries, namely:
34+
Modern MonoGame projects now use the DotNet framework (older projects used to rely on the NetCore/NetFramework libraries). As MonoGame has used DotNet project templates since 3.8.x, you only need to update the `TargetFramework` element of any `csproj` files referencing MonoGame libraries, namely:
3135

32-
- Replace any `<TargetFramework>` entries to the following:
36+
- Replace any `<TargetFramework>` entries with the following:
3337

3438
```xml
3539
<TargetFramework>net9.0</TargetFramework>
3640
```
3741

3842
> [!NOTE]
39-
> Using `DotNet 9` is only a **recommendation**, you can use any version of DotNet (from 8.0 and above) so long as it supports the MonoGame Dotnet 8 dependency. This includes the upcoming DotNet 10 LTS.
43+
> Using `DotNet 9` is only a **recommendation**, you can use any version of DotNet (from 8.0 and above) so long as it supports the MonoGame DotNet 8 dependency. This includes the upcoming DotNet 10 LTS.
4044
4145
Make sure to update any and all projects in your solution, especially you have a multi-project solution similar to those in the [MonoGame.Samples](https://github.com/MonoGame/MonoGame.Samples/tree/3.8.4/Platformer2D)
4246

4347
## Update MonoGame references
4448

45-
Ensure you update the MonoGame references to the latest version, this can be achieved by either:
49+
Make sure you update the MonoGame references to the latest version, this can be achieved by either:
4650

47-
- Editing the `csproj` files that reference MonoGame to the latest version
51+
- Editing the `csproj` files that reference MonoGame to the latest version.
4852

4953
> [!NOTE]
50-
> The MonoGame templates set the Version number as `Version="3.8.*"`, this means that it will use the LATEST public version of MonoGame (not including preview releases) that is available. However, this does mean your `tools` configuration can become out of sync with your project and potentially cause issue.
54+
> The MonoGame templates set the Version number as `Version="3.8.*"`, this means that it will use the LATEST public version of MonoGame (not including preview releases) that is available.
55+
>
56+
> However, this does mean your `tools` configuration can become out of sync with your project and potentially cause issue.
5157
52-
- Use the [Updating NuGet package dependencies](../getting_to_know/howto/HowTo_Install_Preview_Release.md#updating-nuget-package-dependencies) documentation as part of the "Preview Release installation instructions", which states you just need to run the following commands (for `DesktopGL`, use other platforms accordingly):
58+
- Use the [Updating NuGet package dependencies](../getting_to_know/howto/HowTo_Install_Preview_Release.md#updating-nuget-package-dependencies) documentation as part of the "Preview Release installation instructions", which states you should run the following commands (the example is for `DesktopGL`, use other platforms accordingly):
5359

5460
```dotnetcli
5561
dotnet add package MonoGame.Framework.DesktopGL -v 3.8.4.1
@@ -62,25 +68,25 @@ Ensure you update the MonoGame references to the latest version, this can be ach
6268
This will ensure your project is using the intended version of MonoGame.
6369
6470
> [!IMPORTANT]
65-
> Always ensure your `dotnet-tools.json` version matches any updates to the version of MonoGame you are using, see next section.
71+
> Always ensure your `dotnet-tools.json` version matches any updates to the version of MonoGame you are using, as detailed in the next section.
6672
6773
## Add/Update `dotnet-tools.json` Configuration
6874
6975
MonoGame DotNet projects currently **Require** DotNet tools configuration to be able to locate and run the `MGCB` editor which is installed locally per project (preventing issues when working with multiple projects using different versions of MonoGame).
7076
7177
> [!IMPORTANT]
72-
> The MGCB Editor is no longer a .NET global tool, and does not need to be installed or registered. When migrating from 3.8.0, it is recommended that you **uninstall** the global versions of the tools. You can accomplish that with these commands:
78+
> The MGCB Editor is no longer a .NET global tool, and does not need to be installed or registered separately. When migrating from 3.8.0, it is recommended that you **uninstall** the global versions of the tools. You can accomplish that with these commands:
7379
>
7480
> ```sh
7581
> dotnet tool uninstall dotnet-mgcb -g
7682
> dotnet tool uninstall dotnet-2mgfx -g
7783
> dotnet tool uninstall dotnet-mgcb-editor -g
7884
> ```
7985
80-
You can either copy the configuration from a new project template (e.g. `dotnet new mgdesktopgl -o <project name>`),
81-
alternatively you can do the following:
86+
You can either copy the `config` folder with the configuration from a new project template (e.g. `dotnet new mgdesktopgl -o <project name>`),
87+
or alternatively you can do the following:
8288
83-
- Create a new folder in the root of your project named `.config`
89+
- Create a new folder in the root of your project named `.config`.
8490
- Add a new file called `dotnet-tools.json` and replace its contents with the following:
8591
8692
```text
@@ -123,26 +129,26 @@ alternatively you can do the following:
123129
```
124130

125131
> [!NOTE]
126-
> Please note that you cannot use the ```3.8.*``` wildcard in the ```dotnet-tools.json``` file (tool versions have to be fully qualified). We strongly recommand that the versions match the MonoGame version referenced in your ```.csproj``` (if you are using the ```*``` wildcard, make sure that they do not end up mismatching if the nuget's are updated without you noticing).
132+
> Please note that you cannot use the ```3.8.*``` wildcard in the ```dotnet-tools.json``` file (tool versions have to be fully qualified). We strongly recommend that the versions match the MonoGame version referenced in your ```.csproj``` (if you are using the ```*``` wildcard, make sure that they do not end up mismatching if the NuGet packages are updated without you noticing).
127133
128-
The file is the same regardless of which platform / target you are intending to use. If you have a solution, you only need a **SINGLE** configuration at the root of the project for all client projects.
134+
The file is the same regardless of which platform / target you are intending to use. If you have a multi-project solution, you only need a **SINGLE** configuration at the root of the project for all client projects.
129135

130-
## Remove `RestoreDotnetTools` section from csproj
136+
## Remove `RestoreDotNetTools` section from csproj
131137

132-
From `3.8.4.1` and above, the `RestoreDotnetTools` section is no longer required in client project `csproj` files, as the processing is now handled within the MonoGame deliverables.
138+
From `3.8.4.1` and above, the `RestoreDotNetTools` section is no longer required in client project `csproj` files, as the processing is now handled within the MonoGame deliverables.
133139

134140
> [!NOTE]
135-
> Earlier versions of MonoGame, e.g. 3.8.0 does not have this configuration in the project template, if your `csproj` does not have a `RestoreDotnetTools` element, you can safely ignore this section.
141+
> Earlier versions of MonoGame, e.g. 3.8.0 do not have this configuration in the project template, if your `csproj` does not have a `RestoreDotNetTools` element, you can safely ignore this section.
136142
137143
```xml
138-
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
144+
<Target Name="RestoreDotNetTools" BeforeTargets="Restore">
139145
<Message Text="Restoring dotnet tools" Importance="High" />
140146
<Exec Command="dotnet tool restore" />
141147
</Target>
142148
```
143149

144-
> [!NOTE]
145-
> The XML has changed over versions with various messages and layout, but the section to remove is always titled `Name="RestoreDotnetTools"`
150+
> [!TIP]
151+
> The XML has changed over versions with various messages and layout, but the section to remove is always titled `Name="RestoreDotNetTools"`
146152
147153
Simply remove this section safely from any and all `csproj` files located in your solution that are dependent on MonoGame.
148154

@@ -151,5 +157,5 @@ Simply remove this section safely from any and all `csproj` files located in you
151157
DotNet 9 is MANDATORY for iOS and Android due to platform requirements, as well as the following configurations:
152158

153159
- MonoGame 3.8.4.1 is **REQUIRED** to comply with the Google Policies on 16kb pages and other affordances.
154-
- The Android `targetSdkVersion` in the `AndroidManifest.xml` **MUST** be a minimum "35" to comply with the latest Google policies.
160+
- The Android `targetSdkVersion` in the `AndroidManifest.xml` **MUST** be a minimum "35" to comply with the latest Google policies. The templates set the minimum to `21` which is safe, only the `TARGET` SDK is critical.
155161
- iOS **MUST** use a minimum `SupportedOSPlatformVersion` of `12.2` in both the `csproj` and in the `info.plist` configuration for the project.

external/MonoGame

Submodule MonoGame updated 354 files

0 commit comments

Comments
 (0)