You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for testing unpackaged WinUI applications #2784
Results of my investigations on the WinUI issue #1127 (comment) are showing that we now work correctly for all cases but unpackaged applications. Although, this is not a work related to MSTest, I want to keep track of this missing feature.
Thanks Amaury Levé (@Evangelink), is there an issue tracking this in the WinAppSDK repo we can link to?
Also, copying your matrix here and formatting as a table:
WindowsAppSDKSelfContained
Not set
True
False
WindowsPackageType
Not set
None
MSIX
Not set
None
MSIX
Not set
None
MSIX
Result with VSTest
✅
❌
✅
✅
❌
✅
✅
❌
✅
And the resulting error for the NoneWindowsPackageType:
File name: 'C:\src\temp\MSTestWinUI\UnitTest\bin\x64\Debug\net6.0-windows10.0.19041.0\win10-x64\AppxManifest.xml'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.ReadTargetPlatformVersions()
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.AppxManifestFile.get_TargetPlatformVersion()
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.Deployer.Microsoft.VisualStudio.UwpTestHostRuntimeProvider.IDeployer.get_TargetPlatformVersion()
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<LaunchHostAsync>d__36.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.UwpTestHostRuntimeProvider.UwpTestHostManager.<Microsoft-VisualStudio-TestPlatform-ObjectModel-Host-ITestRuntimeProvider-LaunchTestHostAsync>d__28.MoveNext()<---
Please fix it. It's crazy that we are currently using workarounds that bypass UITest and can perfectly run UI tests with WinUI unpackaged, inside visual studio, but the Microsoft team is dismissing this scenario for months...
Two things were fixed along the way rather than just documented:
[UITestMethod] used to swallow startup failures, leaving the completion source uncompleted so the whole run hung with no diagnostic. A throwing Application constructor, or an unresolvable Windows App SDK runtime in an unpackaged app (REGDB_E_CLASSNOTREG), now fails the test with the real cause.
Microsoft.Testing.Extensions.PackagedApp used to enable its launcher on any Windows run, which forced the test-host-controller model and a full copy of the build output to a deployment directory. It is now layout-aware, so an unpackaged app that references it (often transitively through a shared Directory.Packages.props) pays nothing for it.
What is still not supported, and why
VSTest. That is the configuration this issue's matrix measured, and it is unchanged: VSTest routes every UseWinUI project through its UwpTestHostRuntimeProvider, which unconditionally reads AppxManifest.xml from the build output and throws the FileNotFoundException above when there is none. That provider ships in Visual Studio, not in this repository, so it cannot be fixed here.
That matches how the issue was originally framed ("this is not a work related to MSTest, I want to keep track of this missing feature"). The tracked capability now exists, and the remaining gap is a VSTest limitation with a supported alternative, so there is nothing further to track here. If you hit the AppxManifest.xml error, switching that project to EnableMSTestRunner=true is the fix.
Activity
michael-hawker commentedon Apr 30, 2024
Thanks Amaury Levé (@Evangelink), is there an issue tracking this in the WinAppSDK repo we can link to?
Also, copying your matrix here and formatting as a table:
And the resulting error for the
NoneWindowsPackageType:Evangelink commentedon May 2, 2024
Not yet. I am still discussing some details but I will post here the ticket or info once it's sorted.
testplatform-bot commentedon May 2, 2024
✅ Successfully linked to Azure Boards work item(s):
Evangelink commentedon Jun 25, 2024
Postponing to next iteration as there were many bug fixes to handle this sprint.
8 remaining items
ghord commentedon Jan 26, 2025
Please consider running tests as unpackaged. It is really weird to require package manifest with empty logo/images for winui3 unit test projects.
abdes commentedon Oct 8, 2025
Please fix it. It's crazy that we are currently using workarounds that bypass UITest and can perfectly run UI tests with WinUI unpackaged, inside visual studio, but the Microsoft team is dismissing this scenario for months...
Is WinUI that badly perceived at Microsoft?
Address RFC 017 review comments
Condense UI-thread rationale comment and reference #2784
Remove over-claiming WinUI PackagedApp acceptance test
Add acceptance test for packaged-layout fail-fast
Address PR review: resolve app by executable, honest packaged-app des…
Address second review pass: BOM, honest descriptions, correct trackin…
Cover the WinUI startup guards and correct the timeout message
Evangelink commentedon Jul 30, 2026
Closing this: unpackaged WinUI apps can now be tested, via Microsoft.Testing.Platform. Shipped in #10330.
What works now
Set
WindowsPackageType=NoneandEnableMSTestRunner=trueand the app is its own test host, so nothing needs to deploy or activate it:UnpackagedWinUITestsTwo things were fixed along the way rather than just documented:
[UITestMethod]used to swallow startup failures, leaving the completion source uncompleted so the whole run hung with no diagnostic. A throwingApplicationconstructor, or an unresolvable Windows App SDK runtime in an unpackaged app (REGDB_E_CLASSNOTREG), now fails the test with the real cause.Microsoft.Testing.Extensions.PackagedAppused to enable its launcher on any Windows run, which forced the test-host-controller model and a full copy of the build output to a deployment directory. It is now layout-aware, so an unpackaged app that references it (often transitively through a sharedDirectory.Packages.props) pays nothing for it.What is still not supported, and why
VSTest. That is the configuration this issue's matrix measured, and it is unchanged: VSTest routes every
UseWinUIproject through itsUwpTestHostRuntimeProvider, which unconditionally readsAppxManifest.xmlfrom the build output and throws theFileNotFoundExceptionabove when there is none. That provider ships in Visual Studio, not in this repository, so it cannot be fixed here.That matches how the issue was originally framed ("this is not a work related to MSTest, I want to keep track of this missing feature"). The tracked capability now exists, and the remaining gap is a VSTest limitation with a supported alternative, so there is nothing further to track here. If you hit the
AppxManifest.xmlerror, switching that project toEnableMSTestRunner=trueis the fix.abdes commentedon Jul 30, 2026
Thank you.
Evangelink commentedon Jul 30, 2026
Abdessattar Sassi (@abdes) if you get a chance to test it out and give me feedback, that'd be much appreciated.