Skip to content

Commit bcba2fd

Browse files
authored
Upgrade from 7 to 8 (#1855)
* Upgrade from 7 to 8 * Fix link.
1 parent 5278f09 commit bcba2fd

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

docs/whats-new/dotnet-8.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,51 @@ There are plenty of performance changes in .NET MAUI 8. These changes can be cla
146146

147147
For more information, see [.NET 8 Performance Improvements in .NET MAUI](https://devblogs.microsoft.com/dotnet/dotnet-8-performance-improvements-in-dotnet-maui/).
148148

149-
<!-- ## Upgrading from .NET 7
149+
## Upgrade from .NET 7
150150

151-
To upgrade your projects from .NET 6 to .NET 7, open your *.csproj* file and change the Target Framework Monikers (TFMs) from 6 to 7. The following example shows the TFMs for a .NET 6 project:
151+
To upgrade your projects from .NET 7 to .NET 8, install .NET 8 and the .NET MAUI workload with [Visual Studio 17.8+](https://visualstudio.microsoft.com/vs/), or with the [standalone installer](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) and the `dotnet workload install maui` command.
152+
153+
Then, open your *.csproj* file and change the Target Framework Monikers (TFMs) from 7 to 8. The following example shows the TFMs for a .NET 7 project:
152154

153155
```xml
154-
<TargetFrameworks>net6.0-ios;net6.0-android;net6.0-maccatalyst;net6.0-tizen</TargetFrameworks>
155-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks>
156+
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst;net7.0-tizen</TargetFrameworks>
157+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
156158
```
157159

158-
The following example shows the TFMs for a .NET 7 project:
160+
The following example shows the TFMs for a .NET 8 project:
159161

160162
```xml
161-
<TargetFrameworks>net7.0-ios;net7.0-android;net7.0-maccatalyst;net7.0-tizen</TargetFrameworks>
162-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net7.0-windows10.0.19041</TargetFrameworks>
163-
``` -->
163+
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst;net8.0-tizen</TargetFrameworks>
164+
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
165+
```
166+
167+
Explicit package references should also be added to your *.csproj* file for the following .NET MAUI NuGet packages:
168+
169+
```xml
170+
<ItemGroup>
171+
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
172+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
173+
</ItemGroup>
174+
```
175+
176+
The `$(MauiVersion)` variable is referenced from the version of .NET MAUI you've installed. You can override this by adding the `$(MauiVersion)` build property to your *.csproj* file:
177+
178+
```xml
179+
<Project Sdk="Microsoft.NET.Sdk">
180+
<PropertyGroup>
181+
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
182+
<UseMaui>True</UseMaui>
183+
<MauiVersion>8.0.0-rc.2.9511</MauiVersion>
184+
</PropertyGroup>
185+
</Project>
186+
```
187+
188+
This can be useful when using ad-hoc builds from the [nightly feed](https://github.com/dotnet/maui/wiki/Nightly-Builds) or builds downloaded from pull requests.
189+
190+
In addition, the `$(ApplicationIdGuid)` build property can be removed from your *.csproj* file in .NET 8. For more information, see [Behavior changes](#behavior-changes).
191+
192+
> [!NOTE]
193+
> The project template for a .NET MAUI app in .NET 8 enables the nullable context for the project with the `$(Nullable)` build property. For more information, see [Nullable](/dotnet/csharp/language-reference/compiler-options/language#nullable).
164194
165195
<!-- ## See also
166196

0 commit comments

Comments
 (0)