As mentioned in my previous post, I'm using the console to execute my test without mentioning of the solution platform. The failure is happening on my Surface platform.
Also tried to create a new simple nunit project, but when I build it for ARM64, I'm getting an x86 dll:
Hi again,
I was able to get it compiled for ARM64 by adding the following lines to the project file:
And still having the same issue:
C:\hichem\to_be_removed\net5.0-windows>"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" NUnitTestProject1.dll
Microsoft (R) Test Execution Command Line Tool Version 16.8.0
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
NUnit Adapter 3.16.1.0: Test execution started
Running all tests in C:\hichem\to_be_removed\net5.0-windows\NUnitTestProject1.dll
Assembly not supported: C:\hichem\to_be_removed\net5.0-windows\NUnitTestProject1.dll
Exception NUnit.Engine.NUnitEngineException, Exception thrown executing tests
An exception occurred in the driver while loading tests.
at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
at NUnit.Engine.Runners.DirectTestRunner.Explore(TestFilter filter)
at NUnit.Engine.Runners.MasterTestRunner.Explore(TestFilter filter)
at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunAssembly(String assemblyPath, IGrouping
2 testCases, TestFilter filter) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 236 at NUnit.VisualStudio.TestAdapter.NUnit3TestExecutor.RunTests(IEnumerable
1 sources, IRunContext runContext, IFrameworkHandle frameworkHandle) in D:\repos\NUnit\nunit3-vs-adapter\src\NUnitTestAdapter\NUnit3TestExecutor.cs:line 104
Innerexception: System.BadImageFormatException: Could not load file or assembly 'NUnitTestProject1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. An attempt was made to load a program with an incorrect format.
File name: 'NUnitTestProject1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
at NUnit.Engine.Drivers.NUnitNetStandardDriver.Load(String testAssembly, IDictionary`2 settings)
at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
NUnit Adapter 3.16.1.0: Test execution complete
No test is available in C:\hichem\to_be_removed\net5.0-windows\NUnitTestProject1.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Additionally, path to test adapters can be specified using /TestAdapterPath command. Example /TestAdapterPath:<pathToCustomAdapters>.