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
This is a follow-up to #423, as the issue is still reproducible with xunit.runner.visualstudio v3.
In short, one cannot use xUnit to run .NET tests that require package identity, like you could do with UWP.
Using the Unit Test App (WinUI 3 in Desktop) project template, and replacing the MSTest NuGet packages with the xUnit equivalents, the projects builds without errors, and tests appear in Visual Studio's Test Explorer, but they do not run. They're not discovered at runtime: Test discovery finished: 0 Tests found in 1,2 sec
That said, I can't get your project to run dotnet test correctly because of build issues:
$ dotnet test
Restore complete (0.2s)
UnitTestApp failed with 1 error(s) and 1 warning(s) (6.0s) → bin\Debug\net8.0-windows10.0.19041.0\UnitTestApp.dll
C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(208,5): warning NETSDK1198: A publish profile with the name 'win-AnyCPU.pubxml' was not found in the project. Set the PublishProfile property to a valid file name.
C:\Users\bradwilson\.nuget\packages\microsoft.windowsappsdk\1.6.241114003\buildTransitive\Microsoft.Build.Msix.Packaging.targets(1055,5): error : Packaged .NET applications with an app host exe cannot be ProcessorArchitecture neutral. Please specify a RuntimeIdentifier or a Platform other than AnyCPU.
Build failed with 1 error(s) and 1 warning(s) in 6.6s
That said, I can't get your project to run dotnet test correctly because of build issues:
WinUI 3 projects are architecture-specific. You have to specify the platform: dotnet test UnitTestApp.csproj /p:Platform=x64
In that case, tests do run, but they run as unpackaged, so the test fails because the Package.Current API can't be called without package identity.
When using the Visual Studio Test Explorer, however, tests do not run.
This is a follow-up to #423, as the issue is still reproducible with xunit.runner.visualstudio v3.
In short, one cannot use xUnit to run .NET tests that require package identity, like you could do with UWP.
Using the Unit Test App (WinUI 3 in Desktop) project template, and replacing the MSTest NuGet packages with the xUnit equivalents, the projects builds without errors, and tests appear in Visual Studio's Test Explorer, but they do not run. They're not discovered at runtime:
Test discovery finished: 0 Tests found in 1,2 sec
A repro project is included: UnitTestApp.zip
Thanks.
The text was updated successfully, but these errors were encountered: