Skip to content

Commit 0d465cf

Browse files
jfversluisCopilot
andauthored
Add TargetFramework instructions for ManualTest app (#31523)
* Update README with MauiVersion and compile instructions * Uncomment MAUI platform settings in project file * Update src/Controls/tests/ManualTests/Controls.ManualTests.csproj Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ea135a7 commit 0d465cf

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Controls/tests/ManualTests/Controls.ManualTests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<!-- <UseMaui>true</UseMaui> -->
66
<!-- Uncomment the below line to use the specified .NET MAUI version instead of the version provided by the installed workload -->
77
<!-- <MauiVersion>9.0.100</MauiVersion> -->
8+
<!-- Uncomment the below lines to use the specified (default new .NET MAUI app) platforms instead of a variable value from externally -->
9+
<!-- <MauiManualTestsPlatforms>net9.0-android;net9.0-ios;net9.0-maccatalyst</MauiManualTestsPlatforms> -->
10+
<!-- <MauiManualTestsPlatforms Condition="$([MSBuild]::IsOSPlatform('windows'))">$(MauiManualTestsPlatforms);net9.0-windows10.0.19041.0</MauiManualTestsPlatforms>-->
811
<TargetFrameworks>$(MauiManualTestsPlatforms)</TargetFrameworks>
912
<TargetFrameworks Condition=" '$(UseMaui)' != 'true' and '$(IncludePreviousTfms)' == 'true' ">$(TargetFrameworks);$(MauiManualTestsPreviousPlatforms)</TargetFrameworks>
1013
<OutputType>Exe</OutputType>

src/Controls/tests/ManualTests/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,21 @@ Navigate to the Microsoft.Maui.Controls package on the nightly feed (or use tool
167167
</ItemGroup>
168168
```
169169

170+
Note: you can also set the values to `$(MauiVersion)` and set a `<MauiVersion>` node with the version you want to use. See **Method 2**, below.
171+
170172
### How to Compile
171173

172174
This mode is similar to Workloads Mode but allows specifying any available NuGet version for `MauiVersion`. It requires setting `UseMaui=true`.
173175

176+
You will need to manually add the target frameworks to the `<TargetFrameworks>` node when you use this method. For example, running the project on iOS and Android will require:
177+
178+
```xml
179+
<!-- Instead of: <TargetFrameworks>$(MauiManualTestsPlatforms)</TargetFrameworks> do the line below -->
180+
<TargetFrameworks>net10.0-ios;net10.0-android</TargetFrameworks>
181+
```
182+
183+
Depending on the .NET version you want to use, replace `net10.0` prefix with the version you want to use, for example: `net9.0`.
184+
174185
#### Method 1: Using MSBuild Property
175186
```bash
176187
dotnet build -p:UseMaui=true -p:MauiVersion=8.0.0-nightly.8832+sha.feb791fc7-azdo.8163102
@@ -363,4 +374,4 @@ dotnet build
363374
4. **Always restore packages** before building: `dotnet restore`
364375
5. **Keep workloads updated** regularly: `dotnet workload update`
365376
6. **Pin specific versions** in production scenarios
366-
7. **Test across multiple platforms**
377+
7. **Test across multiple platforms**

0 commit comments

Comments
 (0)