Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UWP .NET 9 support for MSTest extensions #3848

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
38c299b
Add UWP .NET 9 support for MSTest extensions
Sergio0694 Sep 16, 2024
6a38f82
Copy public API list to new TFM folder
Sergio0694 Sep 16, 2024
6366254
Fix API surface for new UWP target
Sergio0694 Sep 16, 2024
e6678a1
Remove 'net8.0-windows10.0.26100.0' TFM
Sergio0694 Sep 16, 2024
7f8f4e4
Define 'UwpNet9Minimum' internally
Sergio0694 Oct 19, 2024
29abbe2
Update UWP settings for .NET 9 GA
Sergio0694 Nov 25, 2024
eeccd73
WIP handling modern uwp
Evangelink Nov 29, 2024
be2a1a0
Add sample test app
Evangelink Nov 29, 2024
08743d4
UseUwpTools
Evangelink Nov 29, 2024
13d8b85
fix code analyzer rules
adam-stephenson Jan 9, 2025
d0333e4
merge main
adam-stephenson Jan 9, 2025
e472752
fixing nuget pack
adam-stephenson Jan 9, 2025
09e0b17
update test package references
adam-stephenson Jan 9, 2025
18565f6
Blank project update
adam-stephenson Jan 11, 2025
ecb9349
merge main
adam-stephenson Jan 29, 2025
f2e9e19
remove directory build prop net462 requirement
adam-stephenson Jan 29, 2025
2810169
remove MSTest.Internal.TestFx.Documentation from verify-nupkgs
adam-stephenson Jan 29, 2025
f227d13
remove debug launch from app xaml
adam-stephenson Jan 29, 2025
cbf51a9
update testadapter.nuspec
adam-stephenson Jan 29, 2025
42bf9f4
remove TestFx.Documentation.nuspec
adam-stephenson Jan 29, 2025
cd8dbb0
fix indentation in MSTest.csproj
adam-stephenson Jan 29, 2025
e1782ba
update platformservices csproj
adam-stephenson Jan 29, 2025
fdad4fa
remvoe WINDOWS_UWP constant
adam-stephenson Jan 29, 2025
b648fc0
Update src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
adstep Jan 29, 2025
a8217f9
revert testadapter.nuspec
adam-stephenson Jan 29, 2025
d865745
Merge branch 'user/adstep/uwp-net9-support' of github.com:adstep/test…
adam-stephenson Jan 29, 2025
6801387
fix spacing
adam-stephenson Jan 29, 2025
dc031c5
fix spacing again
adam-stephenson Jan 29, 2025
be53cd2
removing netcurrent from directory.build.props
adam-stephenson Jan 29, 2025
80ad518
Merge branch 'main' into pr/4817
Evangelink Jan 29, 2025
4949712
Make code compile
Evangelink Jan 29, 2025
e3524f7
Simplify samples
Evangelink Jan 29, 2025
2a1baea
Merge pull request #1 from Evangelink/uwp-fixes
adstep Jan 29, 2025
75ccbd2
Merge pull request #1 from adstep/user/adstep/uwp-net9-support
Sergio0694 Jan 29, 2025
7802d1d
Update UWP sample project
Sergio0694 Jan 30, 2025
ad21693
Use file-scoped namespaces
Sergio0694 Jan 30, 2025
5415c69
Merge branch 'main' into user/sergiopedri/uwp-net9-support
Sergio0694 Jan 30, 2025
b4c6df5
update verify nugpkgs numbers for build to work
adam-stephenson Feb 6, 2025
4b7e89a
update verify nugpkgs numbers for build to work
adam-stephenson Feb 6, 2025
3dc6084
Merge branch 'user/sergiopedri/uwp-net9-support' of https://github.co…
adam-stephenson Feb 6, 2025
5167640
merge main
adam-stephenson Feb 6, 2025
83cc658
Merge pull request #3 from adstep/user/adstep/uwp-net9-latest-merge
Sergio0694 Feb 6, 2025
6255866
Remove leftover .csproj stuff on UWP
Sergio0694 Feb 6, 2025
7786b71
Remove unnecessary package reference
Sergio0694 Feb 6, 2025
2f7731e
Simplify ifdefs to clarify changes
Sergio0694 Feb 6, 2025
1478232
Add missing trailing newline
Sergio0694 Feb 6, 2025
fd23847
Update .targets for new pack folder
Sergio0694 Feb 6, 2025
bbc4b81
Fix path of packed .targets file
Sergio0694 Feb 6, 2025
c63fb0c
Fix a typo
Sergio0694 Feb 6, 2025
f07788d
Remove incorrect MSBuild condition
Sergio0694 Feb 6, 2025
229fbc5
Update path to new 'winui+uwp' folder
Sergio0694 Feb 6, 2025
060d3d9
Add 'TestContainer' project capability
Sergio0694 Feb 6, 2025
7b815d4
Merge branch 'main' into user/sergiopedri/uwp-net9-support
Sergio0694 Feb 6, 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: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

<!-- The TFMs to build and test against. -->
<PropertyGroup>
<!-- The windows SDK version of UWP, Modern UWP and WinUI could be aligned -->
<UwpMinimum>uap10.0.16299</UwpMinimum>
<ModernUwpMinimum>net9.0-windows10.0.17763.0</ModernUwpMinimum>
<WinUiMinimum>net6.0-windows10.0.18362.0</WinUiMinimum>

<MicrosoftTestingTargetFrameworks>net6.0;net7.0;net8.0;net9.0</MicrosoftTestingTargetFrameworks>
Expand Down
4 changes: 2 additions & 2 deletions eng/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ function Confirm-NugetPackages {
Write-Verbose "Starting Confirm-NugetPackages."
$expectedNumOfFiles = @{
"MSTest.Sdk" = 15
"MSTest.TestFramework" = 148
"MSTest.TestAdapter" = 75
"MSTest.TestFramework" = 150
"MSTest.TestAdapter" = 77
"MSTest" = 14
"MSTest.Analyzers" = 56
}
Expand Down
5 changes: 5 additions & 0 deletions samples/public/BlankUwpNet9App/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Application
x:Class="BlankUwpNet9App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BlankUwpNet9App" />
83 changes: 83 additions & 0 deletions samples/public/BlankUwpNet9App/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// 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 Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace BlankUwpNet9App;

/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
public sealed partial class App : Application
{
/// <summary>
/// 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().
/// </summary>
public App()
{
InitializeComponent();

Suspending += OnSuspending;
}

/// <inheritdoc/>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
var rootFrame = Window.Current.Content as Frame;

// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active.
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();

rootFrame.NavigationFailed += OnNavigationFailed;

if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
// TODO: Load state from previously suspended application
}

// Place the frame in the current Window
Window.Current.Content = rootFrame;
}

Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.CreateDefaultUI();

// Ensure the current window is active
Window.Current.Activate();

Microsoft.VisualStudio.TestPlatform.TestExecutor.UnitTestClient.Run(args.Arguments);
}

/// <summary>
/// Invoked when Navigation to a certain page fails.
/// </summary>
/// <param name="sender">The Frame which failed navigation.</param>
/// <param name="e">Details about the navigation failure.</param>
private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
=> throw new Exception($"Failed to load page '{e.SourcePageType.FullName}'.");

/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral();

// TODO: Save application state and stop any background activity
deferral.Complete();
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions samples/public/BlankUwpNet9App/BlankUwpNet9App.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.26100.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>win-$(Platform).pubxml</PublishProfile>
<DefaultLanguage>en-US</DefaultLanguage>
<PublishAot>true</PublishAot>
<UseUwp>true</UseUwp>
<DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>
<EnableMsixTooling>true</EnableMsixTooling>
</PropertyGroup>

<ItemGroup>
<ProjectCapability Include="TestContainer" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TestPlatform.TestHost" Version="$(VSTestVersion)" />
<PackageReference Include="MSTest.TestAdapter" Version="$(MSTestVersion)" />
<PackageReference Include="MSTest.TestFramework" Version="$(MSTestVersion)" />
</ItemGroup>

</Project>
37 changes: 37 additions & 0 deletions samples/public/BlankUwpNet9App/BlankUwpNet9App.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35521.163
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlankUwpNet9App", "BlankUwpNet9App.csproj", "{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}"
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
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|arm64.ActiveCfg = Debug|arm64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|arm64.Build.0 = Debug|arm64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|arm64.Deploy.0 = Debug|arm64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|x64.ActiveCfg = Debug|x64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|x64.Build.0 = Debug|x64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|x64.Deploy.0 = Debug|x64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|x86.ActiveCfg = Debug|x86
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|x86.Build.0 = Debug|x86
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Debug|x86.Deploy.0 = Debug|x86
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Release|arm64.ActiveCfg = Release|arm64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Release|arm64.Build.0 = Release|arm64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Release|x64.ActiveCfg = Release|x64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Release|x64.Build.0 = Release|x64
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Release|x86.ActiveCfg = Release|x86
{D9E66319-BE72-4384-93FC-CA0C1B79C7FC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions samples/public/BlankUwpNet9App/MainPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Page
x:Class="BlankUwpNet9App.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:BlankUwpNet9App"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">

<Grid>
<TextBlock Text="Hello world" />
</Grid>
</Page>
29 changes: 29 additions & 0 deletions samples/public/BlankUwpNet9App/MainPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace BlankUwpNet9App;

/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
InitializeComponent();
}
}
50 changes: 50 additions & 0 deletions samples/public/BlankUwpNet9App/Package.appxmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>

<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
IgnorableNamespaces="uap mp">

<Identity
Name="3a1115e9-2ece-44ab-944f-5b6240a08ea6"
Publisher="CN=sergiopedri"
Version="1.0.0.0" />

<mp:PhoneIdentity PhoneProductId="3a1115e9-2ece-44ab-944f-5b6240a08ea6" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

<Properties>
<DisplayName>BlankUwpNet9App</DisplayName>
<PublisherDisplayName>sergiopedri</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>

<Resources>
<Resource Language="x-generate"/>
</Resources>

<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="BlankUwpNet9App.App">
<uap:VisualElements
DisplayName="BlankUwpNet9App"
Square150x150Logo="Assets\Square150x150Logo.png"
Square44x44Logo="Assets\Square44x44Logo.png"
Description="BlankUwpNet9App"
BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png"/>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
</uap:VisualElements>
</Application>
</Applications>

<Capabilities>
<Capability Name="internetClient" />
<Capability Name="privateNetworkClientServer"/>
</Capabilities>
</Package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>ARM64</Platform>
<RuntimeIdentifier>win-arm64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<PublishAot>true</PublishAot>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x64</Platform>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<PublishAot>true</PublishAot>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishProtocol>FileSystem</PublishProtocol>
<Platform>x86</Platform>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<PublishAot>true</PublishAot>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
7 changes: 7 additions & 0 deletions samples/public/BlankUwpNet9App/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"profiles": {
"BlankUwpNet9App": {
"commandName": "MsixPackage"
}
}
}
28 changes: 28 additions & 0 deletions samples/public/BlankUwpNet9App/UnitTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// 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.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;

using Windows.UI.Xaml.Controls;

namespace App1;

[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.AreEqual(0, 0);
}

// Use the UITestMethod attribute for tests that need to run on the UI thread.
[UITestMethod]
public void TestMethod2()
{
Grid grid = new();

Assert.AreEqual(0, grid.MinWidth);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading