Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0aa7d2b
Initial plan
Copilot Oct 26, 2025
471a1a0
Add Windows Release build job for samples in CI pipeline
Copilot Oct 26, 2025
004a209
Improve sample build script to properly fail on build errors
Copilot Oct 26, 2025
3efffd2
Fix batch script variable comparison syntax
Copilot Oct 26, 2025
9203554
Address review feedback: remove BuildMainProducts, add solution files…
Copilot Oct 26, 2025
b90bc20
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Oct 29, 2025
12b1490
Remove colored output from build-samples.ps1 to fix pipeline YAML par…
Copilot Oct 29, 2025
b13f450
Apply suggestion from @Evangelink
Evangelink Oct 29, 2025
5e8bf58
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Oct 29, 2025
9ecbb0a
Apply suggestion from @Evangelink
Evangelink Oct 29, 2025
8ce6ef5
Uncomment Samples_Windows job in pipeline
Evangelink Oct 29, 2025
bf22e18
Clean up azure-pipelines.yml by removing unused tasks
Evangelink Oct 29, 2025
57779c1
Update azure-pipelines.yml
Evangelink Oct 29, 2025
745df4f
Rename job and increase timeout for WindowsSamples
Evangelink Oct 29, 2025
569991b
Update azure-pipelines.yml
Evangelink Oct 29, 2025
4cd6c2c
Fix Join-Path usage for PowerShell 5.1 compatibility
Copilot Oct 29, 2025
ab78477
Try to fix dotnet
Evangelink Oct 29, 2025
b173ac8
Fix
Evangelink Oct 29, 2025
630240e
Address review comments: simplify path handling and use switch parameter
Copilot Oct 30, 2025
d3461a9
Exclude RunnerVsVSTest.sln from CI build (too slow)
Copilot Oct 31, 2025
c4863a1
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Nov 25, 2025
9f4065f
Apply suggestion from @Evangelink
Evangelink Nov 25, 2025
612eeac
Remove RunnerVsVSTest.sln and update build-samples.ps1
Copilot Nov 25, 2025
db9879e
Updates and fixes
Evangelink Nov 25, 2025
f149a4d
Fix markdownlint issues
Evangelink Nov 25, 2025
a530a1b
Revert move
Evangelink Nov 25, 2025
28a6152
Restore MSTestRunnerWinUI.sln that was removed by mistake
Copilot Nov 25, 2025
2e1d87b
Enable TreatWarningsAsErrors for sample builds in CI
Copilot Nov 25, 2025
2081d02
Update
Evangelink Nov 25, 2025
7bd21f6
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Nov 26, 2025
059bcc5
Fixes
Evangelink Nov 26, 2025
9286043
More fixes
Evangelink Nov 26, 2025
fb95556
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Nov 26, 2025
920ed7e
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Nov 27, 2025
3cce9f0
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Nov 27, 2025
be2a374
Merge branch 'main' into copilot/fix-ci-build-for-samples
Evangelink Dec 1, 2025
8c85b1a
Fix issue
Evangelink Dec 1, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We welcome any kind of contribution!
MSTest is shipped as NuGet packages that can be added to your projects. The following table lists all available packages.

| Name | Description | Stable version | Preview version | Dogfood version |
|--------------|---------|:--------------:|:---------------:|:---------------:|
| ------------ | --------- | :------------: | :-------------: | :-------------: |
| MSTest | This package is a meta package that simplifies referencing all recommended MSTest packages. | [![#](https://img.shields.io/nuget/v/mstest.svg?style=flat)](http://www.nuget.org/packages/MSTest/) | [![#](https://img.shields.io/nuget/vpre/mstest.svg?style=flat)](http://www.nuget.org/packages/MSTest/) | [Azure Artifacts](https://dnceng.visualstudio.com/public/_artifacts/feed/test-tools/NuGet/MSTest/versions) |
| MSTest.TestFramework | This package includes the libraries for writing tests with MSTest. To ensure the discovery and execution of your tests, install the `MSTest.TestAdapter` package. | [![#](https://img.shields.io/nuget/v/mstest.testframework.svg?style=flat)](http://www.nuget.org/packages/MSTest.TestFramework/) | [![#](https://img.shields.io/nuget/vpre/mstest.testframework.svg?style=flat)](http://www.nuget.org/packages/MSTest.TestFramework/) | [Azure Artifacts](https://dnceng.visualstudio.com/public/_artifacts/feed/test-tools/NuGet/MSTest.TestFramework/versions) |
| MSTest.TestAdapter | This package includes the adapter logic to discover and run tests. For access to the testing framework, install the `MSTest.TestFramework` package. | [![#](https://img.shields.io/nuget/v/mstest.testadapter.svg?style=flat)](http://www.nuget.org/packages/MSTest.TestAdapter/) | [![#](https://img.shields.io/nuget/vpre/mstest.testadapter.svg?style=flat)](http://www.nuget.org/packages/MSTest.TestAdapter/) | [Azure Artifacts](https://dnceng.visualstudio.com/public/_artifacts/feed/test-tools/NuGet/MSTest.TestAdapter/versions) |
Expand Down
28 changes: 28 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
failOnStderr: false

- job: Linux
timeoutInMinutes: 90
pool:
Expand Down
18 changes: 9 additions & 9 deletions docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ artifacts

with

| directory | description |
|-------------------|-------------|
| bin | Build output of each project. |
| obj | Intermediate directory for each project. |
| packages | NuGet packages produced by all projects in the repo. |
| SymStore | Storage for converted Windows PDBs |
| log | Build binary log and other logs. |
| tmp | Temp files generated during build. |
| toolset | Files generated during toolset restore. |
| directory | description |
|-----------| -----------------------------------------------------------|
| bin | Build output of each project. |
| obj | Intermediate directory for each project. |
| packages | NuGet packages produced by all projects in the repo. |
| SymStore | Storage for converted Windows PDBs |
| log | Build binary log and other logs. |
| tmp | Temp files generated during build. |
| toolset | Files generated during toolset restore. |

## Testing

Expand Down
111 changes: 111 additions & 0 deletions eng/build-samples.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#!/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 -Filter "*.sln" -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) {
$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
2 changes: 2 additions & 0 deletions samples/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions samples/public/BlankUwpNet9App/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
13 changes: 5 additions & 8 deletions samples/public/BlankWinUINet9App/UnitTests.cs
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(VSTestVersion)" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="$(CodeCoverageVersion)" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="$(TestingPlatformVersion)" />
<PackageReference Include="MSTest" Version="$(MSTestVersion)" />
</ItemGroup>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 _)
Expand Down
22 changes: 22 additions & 0 deletions samples/public/mstest-runner/Simple1/Simple1.sln
Original file line number Diff line number Diff line change
@@ -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
Loading