diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index f270ec6424..74f1a7a438 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -165,6 +165,34 @@ stages:
ArtifactName: TestResults_Windows_$(_BuildConfig)
condition: failed()
+ - job: WindowsSamples
+ timeoutInMinutes: 30
+ pool:
+ name: NetCore-Public
+ demands: ImageOverride -equals windows.vs2026preview.scout.amd64.open
+ strategy:
+ matrix:
+ Release:
+ _BuildConfig: Release
+ Debug:
+ _BuildConfig: Debug
+ steps:
+ - task: PowerShell@2
+ displayName: 'Install Windows SDK'
+ inputs:
+ targetType: filePath
+ filePath: './eng/install-windows-sdk.ps1'
+ failOnStderr: true
+ showWarnings: true
+
+ - task: PowerShell@2
+ displayName: 'Build Samples'
+ inputs:
+ targetType: filePath
+ filePath: './eng/build-samples.ps1'
+ arguments: '-Configuration $(_BuildConfig) -TreatWarningsAsErrors'
+ failOnStderr: false
+
- job: Linux
timeoutInMinutes: 90
pool:
diff --git a/eng/build-samples.ps1 b/eng/build-samples.ps1
new file mode 100755
index 0000000000..b4ffaf1892
--- /dev/null
+++ b/eng/build-samples.ps1
@@ -0,0 +1,128 @@
+#!/usr/bin/env pwsh
+<#
+.SYNOPSIS
+ Builds all sample projects in the samples/public folder.
+
+.DESCRIPTION
+ This script iterates through all solution files in samples/public and builds them.
+ It can be used both locally by developers and in CI pipelines.
+
+.PARAMETER Configuration
+ The build configuration to use (default: Release).
+
+.PARAMETER TreatWarningsAsErrors
+ Whether to treat warnings as errors (default: false).
+
+.EXAMPLE
+ .\eng\build-samples.ps1
+ Builds all samples in Release configuration.
+
+.EXAMPLE
+ .\eng\build-samples.ps1 -Configuration Debug
+ Builds all samples in Debug configuration.
+#>
+
+[CmdletBinding()]
+param(
+ [string]$Configuration = "Release",
+ [switch]$TreatWarningsAsErrors
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+
+$repoRoot = Split-Path -Parent $PSScriptRoot
+$samplesFolder = "$repoRoot/samples/public"
+
+# Source the arcade tools to get access to InitializeDotNetCli
+. "$PSScriptRoot/common/tools.ps1"
+
+# Initialize .NET CLI to ensure correct SDK version is available
+$dotnetRoot = InitializeDotNetCli -install:$true
+$dotnetPath = "$dotnetRoot/dotnet.exe"
+
+Write-Host "Building samples in: $samplesFolder"
+Write-Host "Configuration: $Configuration"
+Write-Host ""
+
+$failed = $false
+$successCount = 0
+$failureCount = 0
+
+# Find all solution files in samples/public
+$solutions = Get-ChildItem -Path $samplesFolder -Include @("*.sln", "*.slnx") -Recurse
+
+foreach ($solution in $solutions) {
+ Write-Host "Building solution: $($solution.FullName)"
+
+ # UWP projects require MSBuild instead of dotnet build
+ $isUwpSolution = $solution.Name -eq "BlankUwpNet9App.sln"
+
+ if ($isUwpSolution) {
+ # Restore NuGet packages first for UWP projects
+ $restoreArgs = @(
+ "restore",
+ $solution.FullName,
+ "/p:Configuration=$Configuration",
+ "/p:Platform=x64"
+ )
+
+ & $dotnetPath $restoreArgs
+
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "ERROR: Failed to restore packages for $($solution.Name)"
+ $failed = $true
+ $failureCount++
+ continue
+ }
+
+ $msbuildPath = InitializeVisualStudioMSBuild -install:$true
+
+ $buildArgs = @(
+ $solution.FullName,
+ "/p:Configuration=$Configuration",
+ "/p:TreatWarningsAsErrors=$TreatWarningsAsErrors",
+ "/p:Platform=x64",
+ "/v:minimal"
+ )
+
+ & $msbuildPath $buildArgs
+ }
+ else {
+ $buildArgs = @(
+ "build",
+ $solution.FullName,
+ "--configuration", $Configuration,
+ "/p:TreatWarningsAsErrors=$TreatWarningsAsErrors"
+ )
+
+ & $dotnetPath $buildArgs
+ }
+
+ if ($LASTEXITCODE -ne 0) {
+ Write-Host "ERROR: Failed to build $($solution.Name)"
+ $failed = $true
+ $failureCount++
+ }
+ else {
+ Write-Host "SUCCESS: Built $($solution.Name)"
+ $successCount++
+ }
+
+ Write-Host ""
+}
+
+Write-Host "========================================"
+Write-Host "Build Summary:"
+Write-Host " Total solutions: $($solutions.Count)"
+Write-Host " Succeeded: $successCount"
+Write-Host " Failed: $failureCount"
+Write-Host "========================================"
+
+if ($failed) {
+ Write-Host "One or more samples failed to build"
+ exit 1
+}
+
+Write-Host "All samples built successfully!"
+exit 0
diff --git a/samples/.editorconfig b/samples/.editorconfig
index 2a4c6b6b21..d3b1b69db8 100644
--- a/samples/.editorconfig
+++ b/samples/.editorconfig
@@ -12,3 +12,5 @@ dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = none
+
+dotnet_diagnostic.MSTEST0001.severity = none
\ No newline at end of file
diff --git a/samples/public/BlankUwpNet9App/UnitTests.cs b/samples/public/BlankUwpNet9App/UnitTests.cs
index b517369b25..11afbb8720 100644
--- a/samples/public/BlankUwpNet9App/UnitTests.cs
+++ b/samples/public/BlankUwpNet9App/UnitTests.cs
@@ -13,9 +13,9 @@ public class UnitTest1
{
[TestMethod]
public void TestMethod1()
- {
- Assert.AreEqual(0, 0);
- }
+#pragma warning disable MSTEST0032 // Assertion condition is always true
+ => Assert.AreEqual(0, 0);
+#pragma warning restore MSTEST0032 // Assertion condition is always true
// Use the UITestMethod attribute for tests that need to run on the UI thread.
[UITestMethod]
diff --git a/samples/public/BlankWinUINet9App/UnitTests.cs b/samples/public/BlankWinUINet9App/UnitTests.cs
index 04bad822ea..ad31b82296 100644
--- a/samples/public/BlankWinUINet9App/UnitTests.cs
+++ b/samples/public/BlankWinUINet9App/UnitTests.cs
@@ -1,23 +1,20 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
+// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
using Microsoft.UI.Xaml.Controls;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
namespace BlankWinUINet9App;
+
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
- {
- Assert.AreEqual(0, 0);
- }
+#pragma warning disable MSTEST0032 // Assertion condition is always true
+ => Assert.AreEqual(0, 0);
+#pragma warning restore MSTEST0032 // Assertion condition is always true
// Use the UITestMethod attribute for tests that need to run on the UI thread.
[UITestMethod]
diff --git a/samples/public/Directory.Build.props b/samples/public/Directory.Build.props
index de64c982f5..f0f69b6cd3 100644
--- a/samples/public/Directory.Build.props
+++ b/samples/public/Directory.Build.props
@@ -7,7 +7,7 @@
2.0.0-alpha.25561.4
1.56.0
2.0.2
- 18.0.0
+ 18.0.1
false
$(NoWarn);SA0001;EnableGenerateDocumentationFile
diff --git a/samples/public/mstest-runner/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain.csproj b/samples/public/mstest-runner/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain.csproj
index 18c9151070..9fd76e5a0a 100644
--- a/samples/public/mstest-runner/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain.csproj
+++ b/samples/public/mstest-runner/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain/MSTestProjectWithExplicitMain.csproj
@@ -18,9 +18,6 @@
-
-
-
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI.sln b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI.sln
deleted file mode 100644
index eec4ac626e..0000000000
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI.sln
+++ /dev/null
@@ -1,43 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.5.33627.172
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{E9CD5A8E-3214-46AE-AD52-6102A3987E97}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|ARM64 = Debug|ARM64
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|ARM64 = Release|ARM64
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|ARM64.ActiveCfg = Debug|ARM64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|ARM64.Build.0 = Debug|ARM64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|ARM64.Deploy.0 = Debug|ARM64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|x64.ActiveCfg = Debug|x64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|x64.Build.0 = Debug|x64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|x64.Deploy.0 = Debug|x64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|x86.ActiveCfg = Debug|x86
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|x86.Build.0 = Debug|x86
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Debug|x86.Deploy.0 = Debug|x86
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|ARM64.ActiveCfg = Release|ARM64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|ARM64.Build.0 = Release|ARM64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|ARM64.Deploy.0 = Release|ARM64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|x64.ActiveCfg = Release|x64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|x64.Build.0 = Release|x64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|x64.Deploy.0 = Release|x64
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|x86.ActiveCfg = Release|x86
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|x86.Build.0 = Release|x86
- {E9CD5A8E-3214-46AE-AD52-6102A3987E97}.Release|x86.Deploy.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {1FBE0D4D-1701-4F9B-8010-2460A18F36C0}
- EndGlobalSection
-EndGlobal
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI.slnx b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI.slnx
new file mode 100644
index 0000000000..a4c00614e0
--- /dev/null
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI.slnx
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/LockScreenLogo.scale-200.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/LockScreenLogo.scale-200.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/LockScreenLogo.scale-200.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/LockScreenLogo.scale-200.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/SplashScreen.scale-200.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/SplashScreen.scale-200.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/SplashScreen.scale-200.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/SplashScreen.scale-200.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Square150x150Logo.scale-200.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Square150x150Logo.scale-200.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Square150x150Logo.scale-200.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Square150x150Logo.scale-200.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Square44x44Logo.scale-200.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Square44x44Logo.scale-200.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Square44x44Logo.scale-200.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Square44x44Logo.scale-200.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/StoreLogo.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/StoreLogo.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/StoreLogo.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/StoreLogo.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Wide310x150Logo.scale-200.png b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Wide310x150Logo.scale-200.png
similarity index 100%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Assets/Wide310x150Logo.scale-200.png
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Assets/Wide310x150Logo.scale-200.png
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/UnitTest.csproj b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/MSTestRunnerWinUI.csproj
similarity index 78%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/UnitTest.csproj
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/MSTestRunnerWinUI.csproj
index 62f918b2b3..b881234983 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/UnitTest.csproj
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/MSTestRunnerWinUI.csproj
@@ -1,24 +1,31 @@
- WinExe
+ Exe
net8.0-windows10.0.19041.0
10.0.17763.0
- UnitTest
+ MSTestRunnerWinUI
app.manifest
x86;x64;ARM64
- win10-x86;win10-x64;win10-arm64
- win10-$(Platform).pubxml
+ win-x86;win-x64;win-arm64
+ win-$(Platform).pubxml
true
+ false
true
+ enable
+
-
-
-
+
true
false
$(DefineConstants);MSTEST_RUNNER
+
+
+
+
+
+
@@ -30,12 +37,7 @@
-
-
-
-
-
+
+ False
+ False
+
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Package.appxmanifest b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Package.appxmanifest
similarity index 74%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Package.appxmanifest
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Package.appxmanifest
index b86d7f7bc0..43985d0b8c 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Package.appxmanifest
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Package.appxmanifest
@@ -2,18 +2,21 @@
+
+
- UnitTest
- naver
+ MSTestRunnerWinUI
+ amauryleve
Assets\StoreLogo.png
@@ -31,8 +34,8 @@
Executable="$targetnametoken$.exe"
EntryPoint="$targetentrypoint$">
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-arm64.pubxml b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-arm64.pubxml
similarity index 58%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-arm64.pubxml
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-arm64.pubxml
index a7fdd16b67..8953cce984 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-arm64.pubxml
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-arm64.pubxml
@@ -6,15 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
FileSystem
ARM64
- win10-arm64
+ win-arm64
bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\
true
False
- False
- True
-
\ No newline at end of file
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-x64.pubxml b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-x64.pubxml
similarity index 58%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-x64.pubxml
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-x64.pubxml
index 26ea7e55c1..cd995617c0 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-x64.pubxml
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-x64.pubxml
@@ -6,15 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
FileSystem
x64
- win10-x64
+ win-x64
bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\
true
False
- False
- True
-
\ No newline at end of file
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-x86.pubxml b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-x86.pubxml
similarity index 58%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-x86.pubxml
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-x86.pubxml
index 34d14d4d4a..a70c69425f 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/PublishProfiles/win10-x86.pubxml
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/PublishProfiles/win-x86.pubxml
@@ -6,15 +6,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
FileSystem
x86
- win10-x86
+ win-x86
bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\
true
False
- False
- True
-
\ No newline at end of file
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/launchSettings.json b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/launchSettings.json
new file mode 100644
index 0000000000..44cbb732b8
--- /dev/null
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/Properties/launchSettings.json
@@ -0,0 +1,10 @@
+{
+ "profiles": {
+ "MSTestRunnerWinUI (Package)": {
+ "commandName": "MsixPackage"
+ },
+ "MSTestRunnerWinUI (Unpackaged)": {
+ "commandName": "Project"
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/App.xaml b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestApp.xaml
similarity index 77%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/App.xaml
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestApp.xaml
index e0b0e782d8..7b83a681e8 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/App.xaml
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestApp.xaml
@@ -1,11 +1,9 @@
-
-
-
+
+ xmlns:local="using:MSTestRunnerWinUI">
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/App.xaml.cs b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestApp.xaml.cs
similarity index 67%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/App.xaml.cs
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestApp.xaml.cs
index 93192b9de1..db7d4990f0 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/App.xaml.cs
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestApp.xaml.cs
@@ -1,30 +1,30 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+
using Microsoft.Testing.Platform.Builder;
-using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
-using System;
-using System.Linq;
-using System.Runtime.InteropServices.WindowsRuntime;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
-namespace UnitTest;
-
+namespace MSTestRunnerWinUI;
///
/// Provides application-specific behavior to supplement the default Application class.
///
-public partial class App : Application
+public partial class UnitTestApp : Application
{
+ private Window? _window;
+
///
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
///
- public App()
+ public UnitTestApp()
{
InitializeComponent();
}
@@ -33,6 +33,7 @@ public App()
/// Invoked when the application is launched.
///
/// Details about the launch request and process.
+ [SuppressMessage("Interoperability", "CA1416:Validate platform compatibility", Justification = "")]
protected override
#if MSTEST_RUNNER
async
@@ -43,29 +44,24 @@ void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI();
#endif
- _window = new MainWindow();
+ _window = new UnitTestAppWindow();
_window.Activate();
- UITestMethodAttribute.DispatcherQueue = DispatcherQueue.GetForCurrentThread();
- // Replace back with e.Arguments when https://github.com/microsoft/microsoft-ui-xaml/issues/3368 is fixed
+ UITestMethodAttribute.DispatcherQueue = _window.DispatcherQueue;
+
#if MSTEST_RUNNER
try
{
// Ideally we would want to reuse the generated main so we don't have to manually handle all dependencies
// but this type is generated too late in the build process so we fail before.
// You can build, inspect the generated type to copy its content if you want.
- // await TestingPlatformEntryPoint.Main(Environment.GetCommandLineArgs().Skip(1).ToArray());
+ //await MSTestRunnerWinUI.MicrosoftTestingPlatformEntryPoint.Main(Environment.GetCommandLineArgs().Skip(1).ToArray());
string[] cliArgs = Environment.GetCommandLineArgs()
.Skip(1)
.Where(arg => !arg.Contains("EnableMSTestRunner"))
.ToArray();
ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(cliArgs);
-
- // Or alternatively, we would want to use AddSelfRegisteredExtensions but we have the same issue.
- //builder.AddSelfRegisteredExtensions(cliArgs);
- Microsoft.Testing.Platform.MSBuild.TestingPlatformBuilderHook.AddExtensions(builder, cliArgs);
- Microsoft.Testing.Extensions.Telemetry.TestingPlatformBuilderHook.AddExtensions(builder, cliArgs);
- Microsoft.VisualStudio.TestTools.UnitTesting.TestingPlatformBuilderHook.AddExtensions(builder, cliArgs);
+ builder.AddSelfRegisteredExtensions(cliArgs);
using ITestApplication app = await builder.BuildAsync();
await app.RunAsync();
}
@@ -77,6 +73,4 @@ void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(Environment.CommandLine);
#endif
}
-
- private Window _window;
}
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/MainWindow.xaml b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestAppWindow.xaml
similarity index 50%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/MainWindow.xaml
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestAppWindow.xaml
index a139c9fb1d..49933ce283 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/MainWindow.xaml
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestAppWindow.xaml
@@ -1,14 +1,19 @@
-
-
-
+
+ mc:Ignorable="d"
+ Title="MSTestRunnerWinUI">
+
+
+
+
+
+
-
+
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestAppWindow.xaml.cs b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestAppWindow.xaml.cs
new file mode 100644
index 0000000000..3887d224c5
--- /dev/null
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTestAppWindow.xaml.cs
@@ -0,0 +1,32 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.InteropServices.WindowsRuntime;
+
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Controls.Primitives;
+using Microsoft.UI.Xaml.Data;
+using Microsoft.UI.Xaml.Input;
+using Microsoft.UI.Xaml.Media;
+using Microsoft.UI.Xaml.Navigation;
+
+using Windows.Foundation;
+using Windows.Foundation.Collections;
+
+// To learn more about WinUI, the WinUI project structure,
+// and more about our project templates, see: http://aka.ms/winui-project-info.
+
+namespace MSTestRunnerWinUI;
+
+public sealed partial class UnitTestAppWindow : Window
+{
+ public UnitTestAppWindow()
+ {
+ InitializeComponent();
+ }
+}
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/TestClass.cs b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTests.cs
similarity index 50%
rename from samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/TestClass.cs
rename to samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTests.cs
index 9762a23be6..d5bedba099 100644
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/TestClass.cs
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/UnitTests.cs
@@ -5,15 +5,22 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;
-namespace UnitTest;
+namespace MSTestRunnerWinUI;
[TestClass]
-public class TestClass
+public partial class UnitTest1
{
- [UITestMethod]
+ [TestMethod]
public void TestMethod1()
+#pragma warning disable MSTEST0032 // Assertion condition is always true
+ => Assert.AreEqual(0, 0);
+#pragma warning restore MSTEST0032 // Assertion condition is always true
+
+ // Use the UITestMethod attribute for tests that need to run on the UI thread.
+ [UITestMethod]
+ public void TestMethod2()
{
var grid = new Grid();
- Assert.IsNotNull(grid);
+ Assert.AreEqual(0, grid.MinWidth);
}
}
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/app.manifest b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/app.manifest
new file mode 100644
index 0000000000..d6c6190393
--- /dev/null
+++ b/samples/public/mstest-runner/MSTestRunnerWinUI/MSTestRunnerWinUI/app.manifest
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PerMonitorV2
+
+
+
\ No newline at end of file
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/MainWindow.xaml.cs b/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/MainWindow.xaml.cs
deleted file mode 100644
index 58e846bcb5..0000000000
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/MainWindow.xaml.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT license. See LICENSE file in the project root for full license information.
-
-using Microsoft.UI.Xaml;
-
-// To learn more about WinUI, the WinUI project structure,
-// and more about our project templates, see: http://aka.ms/winui-project-info.
-
-namespace UnitTest;
-
-///
-/// An empty window that can be used on its own or navigated to within a Frame.
-///
-public sealed partial class MainWindow : Window
-{
- public MainWindow()
- {
- InitializeComponent();
- }
-}
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/launchSettings.json b/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/launchSettings.json
deleted file mode 100644
index 5f98bdda88..0000000000
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/Properties/launchSettings.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "profiles": {
- "UnitTest MSTest Runner (Package)": {
- "commandName": "MsixPackage",
- "commandLineArgs": "/p:EnableMSTestRunner=true"
- },
- "UnitTest MSTest Runner (Unpackaged)": {
- "commandName": "Project",
- "commandLineArgs": "/p:EnableMSTestRunner=true"
- },
- "UnitTest VSTest (Package)": {
- "commandName": "MsixPackage",
- "commandLineArgs": "/p:EnableMSTestRunner=false"
- },
- "UnitTest VSTest (Unpackaged)": {
- "commandName": "Project",
- "commandLineArgs": "/p:EnableMSTestRunner=false"
- }
- }
-}
diff --git a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/app.manifest b/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/app.manifest
deleted file mode 100644
index d8d425fd90..0000000000
--- a/samples/public/mstest-runner/MSTestRunnerWinUI/UnitTest/app.manifest
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true/PM
- PerMonitorV2, PerMonitor
-
-
-
\ No newline at end of file
diff --git a/samples/public/mstest-runner/RunInDocker/MyServer.Tests/UnitTest1.cs b/samples/public/mstest-runner/RunInDocker/MyServer.Tests/UnitTest1.cs
index 913419cb89..ee55649de5 100644
--- a/samples/public/mstest-runner/RunInDocker/MyServer.Tests/UnitTest1.cs
+++ b/samples/public/mstest-runner/RunInDocker/MyServer.Tests/UnitTest1.cs
@@ -10,7 +10,7 @@ namespace MyServer.Tests;
[TestClass]
public class ServerManager
{
- public static Process? ServerProcess;
+ private static Process? ServerProcess;
[AssemblyInitialize]
public static async Task StartServer(TestContext _)
diff --git a/samples/public/mstest-runner/Simple1/Simple1.sln b/samples/public/mstest-runner/Simple1/Simple1.sln
new file mode 100644
index 0000000000..09a5e60fe6
--- /dev/null
+++ b/samples/public/mstest-runner/Simple1/Simple1.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simple1", "Simple1.csproj", "{2AE4FD73-ECFB-4AB0-A02D-A1863750C012}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2AE4FD73-ECFB-4AB0-A02D-A1863750C012}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2AE4FD73-ECFB-4AB0-A02D-A1863750C012}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2AE4FD73-ECFB-4AB0-A02D-A1863750C012}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2AE4FD73-ECFB-4AB0-A02D-A1863750C012}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal