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

Make vstest.console, and datacollector upgrade across major .NET version #3561

Merged
merged 2 commits into from
Apr 8, 2022

Conversation

nohwnd
Copy link
Member

@nohwnd nohwnd commented Apr 8, 2022

Description

vstest.console and datacollector are our tools and they should be able to run on any .NET version from netcoreapp2.1 onwards. But in the cli, and portable packages we ship runtime config with them that ties them to netcoreapp2.1.

dotnet SDK rewrites our runtime.config.json to use the same version as what the SDK is, but our nugets don't have that change, and tooling authors work around this by setting DOTNET_ROLL_FORWARD policy by environment variables, which inherits downwards to testhost where that policy is undesirable.

Setting RollForward in our project will emit it in runtimeconfig.json and will tell vstest.console and datacollector and allows us to upgrade to a newer runtime even across major version. This won't upgrade to pre-releases, and won't upgrade to the latest version available, because we currently have no way to rewrite this option in the actual SDK shipment.

@nohwnd
Copy link
Member Author

nohwnd commented Apr 8, 2022

My only concern here is what dotnet SDK actually does with our runtimeconfig.json and if we can strip the preference there, because we want to keep it working as is.

What users currently see:

C:\t> dotnet "C:\Users\jajares\Downloads\
		microsoft.testplatform.portable.17.2.0-preview-20220401-08\tools\
		  netcoreapp2.1\vstest.console.dll"


You must install or update .NET to run this application.

App: C:\Users\jajares\Downloads\microsoft.testplatform.portable.17.2.0-preview-20220401-08\tools\netcoreapp2.1\vstest.console.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '2.1.0' (x64)
.NET location: C:\Program Files\dotnet\

The following frameworks were found:
  3.0.3 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

@MarcoRossignoli
Copy link
Contributor

MarcoRossignoli commented Apr 8, 2022

@nohwnd nohwnd changed the title Make vstest.console, and datacollector use latest major .NET version Make vstest.console, and datacollector upgrade across major .NET version Apr 8, 2022
@nohwnd
Copy link
Member Author

nohwnd commented Apr 8, 2022

Updated the description and code to use Major, instead of LatestMajor, so we can ship this asap.

No shipments in sdk use LatestMajor, except for dotnet-format which is a dotnet-tool.

C:\Program Files\dotnet> ls *.runtimeconfig.json -re | sls rollForward

@nohwnd nohwnd merged commit af649d1 into microsoft:main Apr 8, 2022
@nohwnd nohwnd deleted the roll-forward-latest-major branch April 8, 2022 18:44
@nohwnd
Copy link
Member Author

nohwnd commented Apr 11, 2022

/fyi @rouke-broersma @peterwald this will ship in .NET 7, and TP17.3. You both have DOTNET_ROLL_FORWARD policy in place to work around this.

@rouke-broersma
Copy link

Cool! I am liking these recent improvements to the portable/client-wrapper workload :)

@rouke-broersma
Copy link

@nohwnd Do we need .net7 AND TP17.3 for this to work? I'm currently testing with TP17.3 and .net6 and it's failing with this message:

[11:20:02 DBG] Runner 0: You must install or update .NET to run this application. (VsTest error)
[11:20:02 DBG] Runner 0:  (VsTest error)
[11:20:02 DBG] Runner 0: App: /home/vsts/work/1/.nuget/packages/microsoft.testplatform.testhost/17.3.2/lib/netcoreapp2.1/testhost.dll (VsTest error)
[11:20:02 DBG] Runner 0: Architecture: x64 (VsTest error)
[11:20:02 DBG] Runner 0: Framework: 'Microsoft.NETCore.App', version '3.1.0' (x64) (VsTest error)
[11:20:02 DBG] Runner 0: .NET location: /opt/hostedtoolcache/dotnet/ (VsTest error)
[11:20:02 DBG] Runner 0:  (VsTest error)
[11:20:02 DBG] Runner 0: The following frameworks were found: (VsTest error)
[11:20:02 DBG] Runner 0:   6.0.9 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App] (VsTest error)
[11:20:02 DBG] Runner 0:  (VsTest error)
[11:20:02 DBG] Runner 0: Learn about framework resolution: (VsTest error)
[11:20:02 DBG] Runner 0: https://aka.ms/dotnet/app-launch-failed (VsTest error)
[11:20:02 DBG] Runner 0:  (VsTest error)
[11:20:02 DBG] Runner 0: To install missing framework, download: (VsTest error)
[11:20:02 DBG] Runner 0: https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.0&arch=x64&rid=ubuntu.20.04-x64 (VsTest error)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants