question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

7.0 Release not taking into account global.json and downgrade to 6

See original GitHub issue

I have a global.json targeting 6.0.403

{ "sdk": { "version": "6.0.403", "rollForward": "latestMinor" } }

This is my donet --info

image

If I @System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription; in my application I get: image

I’m using the latest Visual Studio Mac Preview. But doing this from a command line.

Getting errors because 7 is running instead of 6.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
vitek-karascommented, Mar 28, 2023

The DOTNET_ROLL_FORWARD explains this fully - no need for the hosting logs. The question is why is that variable set from VS Mac.

@artl93 who might be able to help with this: The short version is that in this case it seems VS Mac sets environment variable DOTNET_ROLL_FORWARD=LatestMajor for the app when it launches it. This forces the app to run on the latest available .NET runtime on the machine, which may cause problems for some apps.

0reactions
danieltharriscommented, Mar 27, 2023

@vitek-karas there’s no executable, however using dotnet bin/Debug/net6.0/appname.dll or just dotnet run from a standalone terminal works and the project is running under .NET 6 as expected.

At the start of my testing this evening after seeing your message I’ve got 4 scenarios:

1: dotnet run from standalone terminal works ✅

2: dotnet run from the VS Code integrated terminal works ✅

3: dotnet run from the VS Mac 2022 integrated terminal gives the .NET 7 related error ❌

4: run and debug from VS 2022 Mac gives the .NET 7 related error ❌

I started to dig around a bit more and I’ve found that the VS Mac 2022 Integrated terminal has the following environment variable set when I run the export command:

DOTNET_ROLL_FORWARD=LatestMajor

This is not present when executing export from either a standalone, or the VS Code integrated terminals.

If I change the env variable in the VS Mac 2022 integrated terminal with the following command:

export DOTNET_ROLL_FORWARD=LatestMinor

Then this fixes scenario 3 from the original list above…Setting it back to LatestMajor reliably breaks scenario 3 again.

This still leaves scenario 4 where debugging from VS Mac 2022 results in .NET 7 being used.

I will try to enable host tracing to see if it can help diagnose scenario 4. Not sure if DOTNET_ROLL_FORWARD is supposed to be “LatestMajor” in a standard VS 2022 Mac installation; Hopefully the above helps shed some light on what could be happening.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NETSDK1045: The current .NET SDK does not support ...
Check for a global. json file in the root folder in your project and up the directory chain to the root of the...
Read more >
Why I cannot open this Solution, I installed SDK version 7.0 ...
1 Answer 1 ... Either upgrade to Visual Studio 2022 or downgrade the project to .NET 6. I would go with the former...
Read more >
Cisco Firepower Release Notes, Version 7.0
7.0 - Downgrade to LSP version used in 6.7 causes deployment failure ... ASA does not use the interface specified in the name-server...
Read more >
Downgrade | GitLab
When downgrading between major versions, take into account the specific version changes that occurred when you upgraded to the major version you are...
Read more >
Changelog | Cypress Documentation
Fixed an issue where having cypress.config in a nested directory would cause problems with locating the component-index.html file when using component testing.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found