Skip to content

How can I run tests from selected project using x86 dotnet cli? #48660

@adamsitnik

Description

@adamsitnik

I am trying to repro locally an issue from #33505

What I did:

git clone https://github.com/nxtn/runtime.git longpath
cd longpath
git checkout longpath
.\build.cmd libs -c Debug -arch x86
$env:DOTNET_MULTILEVEL_LOOKUP=1
.\artifacts\bin\testhost\net6.0-windows-Debug-x86\dotnet.exe build -c Debug -f net6.0-windows .\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj /t:Test

This gave me the following output:

Microsoft (R) Build Engine version 16.9.0-preview-21103-02+198f3f262 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error : Invalid restore input. Duplicate frameworks found: 'net6.0-windows7.0, net6.0, netstandard2.0, netstandard2.0, net461'. Input files: C:\Projects\longpath\src\libraries\Microsoft.Win32.Registry\src\Microsoft.Win32.Registry.csproj. [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateFrameworks(PackageSpec spec, IEnumerable`1 files) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateProjectSpecPackageReference(PackageSpec spec, IEnumerable`1 files) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateProjectSpec(PackageSpec spec) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(DependencyGraphSpec spec, HashSet`1 projectsToSkip) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.DependencyGraphSpecRequestProvider.GetRequestsFromItems(RestoreArgs restoreContext, DependencyGraphSpec dgFile) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.DependencyGraphSpecRequestProvider.CreateRequests(RestoreArgs restoreContext) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.RestoreRunner.CreatePreLoadedRequests(RestoreArgs restoreContext) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.RestoreRunner.GetRequests(RestoreArgs restoreContext) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Commands.RestoreRunner.RunAsync(RestoreArgs restoreContext, CancellationToken token) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Build.Tasks.BuildTasksUtility.RestoreAsync(DependencyGraphSpec dependencyGraphSpec, Boolean interactive, Boolean recursive, Boolean noCache, Boolean ignoreFailedSources, Boolean disableParallel, Boolean force, Boolean forceEvaluate, Boolean hideWarningsAndErrors, Boolean restorePC, Boolean cleanupAssetsForUnsupportedProjects, ILogger log, CancellationToken cancellationToken) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
C:\Program Files (x86)\dotnet\sdk\6.0.100-preview.1.21103.13\NuGet.RestoreEx.targets(19,5): error :    at NuGet.Build.Tasks.Console.MSBuildStaticGraphRestore.RestoreAsync(String entryProjectFilePath, IDictionary`2 globalProperties, IReadOnlyDictionary`2 options) [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]

It looks like netstandard2.0-windows and netstandard2.0 and treated as duplicates:

<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netstandard2.0-windows;netstandard2.0;net461-windows</TargetFrameworks>

So I've run:

.\artifacts\bin\testhost\net6.0-windows-Debug-x86\dotnet.exe restore .\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj  
  Determining projects to restore...
  Restored C:\Projects\longpath\src\libraries\System.Threading\ref\System.Threading.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\LongPath\LongPath.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.Collections\ref\System.Collections.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.ComponentModel\ref\System.ComponentModel.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.AccessControl\src\System.Security.AccessControl.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.ComponentModel.TypeConverter\ref\System.ComponentModel.TypeConverter.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.Windows.Extensions\src\System.Windows.Extensions.csproj (in 192 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Principal\ref\System.Security.Principal.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.Windows.Extensions\ref\System.Windows.Extensions.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.DirectoryServices\ref\System.DirectoryServices.csproj (in 186 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Principal.Windows\src\System.Security.Principal.Windows.csproj (in 209 ms).
  Restored C:\Projects\longpath\src\libraries\System.DirectoryServices\src\System.DirectoryServices.csproj (in 208 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Cryptography.Encoding\ref\System.Security.Cryptography.Encoding.csproj (in 34 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Cryptography.Algorithms\ref\System.Security.Cryptography.Algorithms.csproj (in 16 ms).
  Restored C:\Projects\longpath\src\libraries\Microsoft.Win32.Primitives\ref\Microsoft.Win32.Primitives.csproj (in 15 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Cryptography.X509Certificates\ref\System.Security.Cryptography.X509Certificates.csproj (in 41 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Cryptography.Primitives\ref\System.Security.Cryptography.Primitives.csproj (in 38 ms).
  Restored C:\Projects\longpath\src\libraries\System.Net.Primitives\ref\System.Net.Primitives.csproj (in 13 ms).
  Restored C:\Projects\longpath\src\libraries\System.Drawing.Primitives\ref\System.Drawing.Primitives.csproj (in 38 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Claims\ref\System.Security.Claims.csproj (in 20 ms).
  Restored C:\Projects\longpath\src\libraries\System.Drawing.Common\ref\System.Drawing.Common.csproj (in 50 ms).
  Restored C:\Projects\longpath\src\libraries\System.Memory\ref\System.Memory.csproj (in 11 ms).
  Restored C:\Projects\longpath\src\libraries\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj (in 15 ms).
  Restored C:\Projects\longpath\src\libraries\System.IO.FileSystem.AccessControl\ref\System.IO.FileSystem.AccessControl.csproj (in 61 ms).
  Restored C:\Projects\longpath\src\libraries\Microsoft.Win32.Registry\ref\Microsoft.Win32.Registry.csproj (in 74 ms).
  Restored C:\Projects\longpath\src\libraries\System.ComponentModel.EventBasedAsync\ref\System.ComponentModel.EventBasedAsync.csproj (in 16 ms).
  Restored C:\Projects\longpath\src\libraries\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj (in 16 ms).
  Restored C:\Projects\longpath\src\libraries\System.Collections.Specialized\ref\System.Collections.Specialized.csproj (in 19 ms).
  Restored C:\Projects\longpath\src\libraries\Common\tests\TestUtilities\TestUtilities.csproj (in 82 ms).
  Restored C:\Projects\longpath\src\libraries\System.Runtime\ref\System.Runtime.csproj (in 16 ms).
  Restored C:\Projects\longpath\src\libraries\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj (in 12 ms).
  Restored C:\Projects\longpath\src\libraries\System.Resources.Writer\ref\System.Resources.Writer.csproj (in 10 ms).
  Restored C:\Projects\longpath\src\libraries\System.ObjectModel\ref\System.ObjectModel.csproj (in 15 ms).
  Restored C:\Projects\longpath\src\libraries\System.IO.FileSystem.AccessControl\src\System.IO.FileSystem.AccessControl.csproj (in 41 ms).
  Restored C:\Projects\longpath\src\libraries\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj (in 11 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.AccessControl\ref\System.Security.AccessControl.csproj (in 46 ms).
  Restored C:\Projects\longpath\src\libraries\System.Net.WebSockets\ref\System.Net.WebSockets.csproj (in 34 ms).
  Restored C:\Projects\longpath\src\libraries\Microsoft.Win32.Registry\src\Microsoft.Win32.Registry.csproj (in 77 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Principal.Windows\ref\System.Security.Principal.Windows.csproj (in 59 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Permissions\ref\System.Security.Permissions.csproj (in 54 ms).
  Restored C:\Projects\longpath\src\libraries\System.Security.Permissions\src\System.Security.Permissions.csproj (in 82 ms).
  Restored C:\Projects\longpath\src\libraries\System.Runtime.CompilerServices.Unsafe\ref\System.Runtime.CompilerServices.Unsafe.csproj (in 120 ms).
  Restored C:\Projects\longpath\src\libraries\System.Runtime.CompilerServices.Unsafe\src\System.Runtime.CompilerServices.Unsafe.ilproj (in 134 ms).
  1 of 44 projects are up-to-date for restore

Tried dotnet build again and got the same error (Invalid restore input. Duplicate frameworks found)

So I've tried with --no-restore:

.\artifacts\bin\testhost\net6.0-windows-Debug-x86\dotnet.exe build -c Debug -f net6.0-windows --no-restore .\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj /t:Test

And got the following output:

Microsoft (R) Build Engine version 16.9.0-preview-21103-02+198f3f262 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  LongPath -> C:\Projects\longpath\artifacts\bin\LongPath\net6.0-Debug\LongPath.dll
  System.Runtime -> C:\Projects\longpath\artifacts\bin\System.Runtime\ref\net6.0-Debug\System.Runtime.dll
  System.ComponentModel -> C:\Projects\longpath\artifacts\bin\System.ComponentModel\ref\net6.0-Debug\System.ComponentModel.dll
  System.Resources.Writer -> C:\Projects\longpath\artifacts\bin\System.Resources.Writer\ref\net6.0-Debug\System.Resources.Writer.dll
  System.Runtime.Extensions -> C:\Projects\longpath\artifacts\bin\System.Runtime.Extensions\ref\net6.0-Debug\System.Runtime.Extensions.dll
  System.Collections -> C:\Projects\longpath\artifacts\bin\System.Collections\ref\net6.0-Debug\System.Collections.dll
  System.Security.Principal.Windows -> C:\Projects\longpath\artifacts\bin\System.Security.Principal.Windows\ref\netstandard2.0-Debug\System.Security.Principal.Windows.dll
  System.Collections.NonGeneric -> C:\Projects\longpath\artifacts\bin\System.Collections.NonGeneric\ref\net6.0-Debug\System.Collections.NonGeneric.dll
  System.Runtime.InteropServices -> C:\Projects\longpath\artifacts\bin\System.Runtime.InteropServices\ref\net6.0-Debug\System.Runtime.InteropServices.dll
  System.ObjectModel -> C:\Projects\longpath\artifacts\bin\System.ObjectModel\ref\net6.0-Debug\System.ObjectModel.dll
  System.Security.AccessControl -> C:\Projects\longpath\artifacts\bin\System.Security.AccessControl\ref\netstandard2.0-Debug\System.Security.AccessControl.dll
  System.ComponentModel.Primitives -> C:\Projects\longpath\artifacts\bin\System.ComponentModel.Primitives\ref\net6.0-Debug\System.ComponentModel.Primitives.dll
  Microsoft.Win32.Registry -> C:\Projects\longpath\artifacts\bin\Microsoft.Win32.Registry\ref\netstandard2.0-Debug\Microsoft.Win32.Registry.dll
  System.Security.Principal -> C:\Projects\longpath\artifacts\bin\System.Security.Principal\ref\net6.0-Debug\System.Security.Principal.dll
  System.Memory -> C:\Projects\longpath\artifacts\bin\System.Memory\ref\net6.0-Debug\System.Memory.dll
  System.Drawing.Primitives -> C:\Projects\longpath\artifacts\bin\System.Drawing.Primitives\ref\net6.0-Debug\System.Drawing.Primitives.dll
  System.ComponentModel.TypeConverter -> C:\Projects\longpath\artifacts\bin\System.ComponentModel.TypeConverter\ref\net6.0-Debug\System.ComponentModel.TypeConverter.dll
  System.Security.Principal.Windows -> C:\Projects\longpath\artifacts\bin\System.Security.Principal.Windows\netstandard2.0-Debug\System.Security.Principal.Windows.dll
  System.Drawing.Common -> C:\Projects\longpath\artifacts\bin\System.Drawing.Common\ref\net6.0-Debug\System.Drawing.Common.dll
  Microsoft.Win32.Primitives -> C:\Projects\longpath\artifacts\bin\Microsoft.Win32.Primitives\ref\net6.0-Debug\Microsoft.Win32.Primitives.dll
  System.Net.Primitives -> C:\Projects\longpath\artifacts\bin\System.Net.Primitives\ref\net6.0-Debug\System.Net.Primitives.dll
  System.Security.AccessControl -> C:\Projects\longpath\artifacts\bin\System.Security.AccessControl\netstandard2.0-Debug\System.Security.AccessControl.dll
  System.Collections.Specialized -> C:\Projects\longpath\artifacts\bin\System.Collections.Specialized\ref\net6.0-Debug\System.Collections.Specialized.dll
  System.Net.WebSockets -> C:\Projects\longpath\artifacts\bin\System.Net.WebSockets\ref\net6.0-Debug\System.Net.WebSockets.dll
  System.Security.Claims -> C:\Projects\longpath\artifacts\bin\System.Security.Claims\ref\net6.0-Debug\System.Security.Claims.dll
  System.Security.Principal.Windows -> C:\Projects\longpath\artifacts\bin\System.Security.Principal.Windows\ref\net6.0-Debug\System.Security.Principal.Windows.dll
  System.Threading -> C:\Projects\longpath\artifacts\bin\System.Threading\ref\net6.0-Debug\System.Threading.dll
  System.Security.Cryptography.Primitives -> C:\Projects\longpath\artifacts\bin\System.Security.Cryptography.Primitives\ref\net6.0-Debug\System.Security.Cryptography.Primitives.dll
  System.Security.AccessControl -> C:\Projects\longpath\artifacts\bin\System.Security.AccessControl\ref\net6.0-Debug\System.Security.AccessControl.dll
  System.Security.Cryptography.Encoding -> C:\Projects\longpath\artifacts\bin\System.Security.Cryptography.Encoding\ref\net6.0-Debug\System.Security.Cryptography.Encoding.dll
  System.ComponentModel.EventBasedAsync -> C:\Projects\longpath\artifacts\bin\System.ComponentModel.EventBasedAsync\ref\net6.0-Debug\System.ComponentModel.EventBasedAsync.dll
  System.Security.Cryptography.Algorithms -> C:\Projects\longpath\artifacts\bin\System.Security.Cryptography.Algorithms\ref\net6.0-Debug\System.Security.Cryptography.Algorithms.dll
  TestUtilities -> C:\Projects\longpath\artifacts\bin\TestUtilities\net6.0-Debug\TestUtilities.dll
  System.Security.Cryptography.X509Certificates -> C:\Projects\longpath\artifacts\bin\System.Security.Cryptography.X509Certificates\ref\net6.0-Debug\System.Security.Cryptography.X509Certificates.dll
  System.Windows.Extensions -> C:\Projects\longpath\artifacts\bin\System.Windows.Extensions\ref\net6.0-Debug\System.Windows.Extensions.dll
  System.Windows.Extensions -> C:\Projects\longpath\artifacts\bin\System.Windows.Extensions\net6.0-Debug\System.Windows.Extensions.dll
  System.Security.Principal.Windows -> C:\Projects\longpath\artifacts\bin\System.Security.Principal.Windows\ref\netcoreapp3.0-Debug\System.Security.Principal.Windows.dll
  System.Drawing.Common -> C:\Projects\longpath\artifacts\bin\System.Drawing.Common\ref\netcoreapp3.0-Debug\System.Drawing.Common.dll
  System.Windows.Extensions -> C:\Projects\longpath\artifacts\bin\System.Windows.Extensions\ref\netcoreapp3.0-Debug\System.Windows.Extensions.dll
  System.Security.Permissions -> C:\Projects\longpath\artifacts\bin\System.Security.Permissions\ref\net5.0-Debug\System.Security.Permissions.dll
  System.Security.Permissions -> C:\Projects\longpath\artifacts\bin\System.Security.Permissions\net6.0-Debug\System.Security.Permissions.dll
  System.Security.Principal.Windows -> C:\Projects\longpath\artifacts\bin\System.Security.Principal.Windows\net6.0-windows-Debug\System.Security.Principal.Windows.dll
  System.Windows.Extensions -> C:\Projects\longpath\artifacts\bin\System.Windows.Extensions\net6.0-windows-Debug\System.Windows.Extensions.dll
  System.Security.AccessControl -> C:\Projects\longpath\artifacts\bin\System.Security.AccessControl\net6.0-windows-Debug\System.Security.AccessControl.dll
  Microsoft.Win32.Registry -> C:\Projects\longpath\artifacts\bin\Microsoft.Win32.Registry\net6.0-windows-Debug\Microsoft.Win32.Registry.dll
  System.IO.FileSystem.AccessControl -> C:\Projects\longpath\artifacts\bin\System.IO.FileSystem.AccessControl\ref\netstandard2.0-Debug\System.IO.FileSystem.AccessControl.dll
  System.IO.FileSystem.AccessControl -> C:\Projects\longpath\artifacts\bin\System.IO.FileSystem.AccessControl\net6.0-windows-Debug\System.IO.FileSystem.AccessControl.dll
  System.Security.Permissions -> C:\Projects\longpath\artifacts\bin\System.Security.Permissions\ref\netstandard2.0-Debug\System.Security.Permissions.dll
  System.DirectoryServices -> C:\Projects\longpath\artifacts\bin\System.DirectoryServices\ref\netstandard2.0-Debug\System.DirectoryServices.dll
  System.DirectoryServices -> C:\Projects\longpath\artifacts\bin\System.DirectoryServices\net6.0-windows-Debug\System.DirectoryServices.dll
  System.Diagnostics.Process.Tests -> C:\Projects\longpath\artifacts\bin\System.Diagnostics.Process.Tests\net6.0-windows-Debug\System.Diagnostics.Process.Tests.dll
  ----- start Tue 02/23/2021 20:18:13.48 ===============  To repro directly: =====================================================
  pushd C:\Projects\longpath\artifacts\bin\System.Diagnostics.Process.Tests\net6.0-windows-Debug\
  "C:\Projects\longpath\artifacts\bin\testhost\net6.0-windows-Debug-x64\dotnet.exe" exec --runtimeconfig System.Diagnostics.Process.Tests.runtimeconfig.json --depsfile System.Diagnostics.Process.Tests.deps.json xunit.console.dll System.Diagnostics.Process.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -notrait category=failing
  popd
  ===========================================================================================================
  '"C:\Projects\longpath\artifacts\bin\testhost\net6.0-windows-Debug-x64\dotnet.exe"' is not recognized as an internal or external command,
  operable program or batch file.
  ----- end Tue 02/23/2021 20:18:13.48 ----- exit code 9009 ----------------------------------------------------------
C:\Projects\longpath\eng\testing\tests.targets(117,5): error : One or more tests failed while running tests from 'System.Diagnostics.Process.Tests'. [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]

Build FAILED.

C:\Projects\longpath\eng\testing\tests.targets(117,5): error : One or more tests failed while running tests from 'System.Diagnostics.Process.Tests'. [C:\Projects\longpath\src\libraries\System.Diagnostics.Process\tests\System.Diagnostics.Process.Tests.csproj]
    0 Warning(s)
    1 Error(s)

It seems that it tried to use x64 instead of x86 .exe.

@safern @ViktorHofer Am I doing something wrong? How can I run tests from given project using x86?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions