Apologies for this not being massively Umbraco specific, but i've just installed the final .net7 SDK along with a Visual Studio upgrade and now seem to be having some problems....
Upon re-opening my .net 6/Umbraco 10 project I can no longer use dotnet watch run and get the following error:
Unhandled exception. System.IO.FileNotFoundException: Could not find file or assembly 'System.Runtime, Version=7.0.0.0.
So, two things. 1. I'm not using .net7 in this project and 2. I have .net 7 installed and it's complaining I don't, but I guess it's because the project targets .net 6.
If I use dotnet build and dotnet build run....all is good! Any help much appreciated.
For now, a solution could be adding a global.json file at the root of your project with the following content:
{
"sdk": {
"version": "6.0.403"
}
}
This tells .NET to use a specific SDK rather than the newest. I think 6.0.403 is the newest version of .NET 6, but in my case, mine was a bit older. If you don't have the specified version, dotnet watch will result in an error but also list of versions that you do have installed.
So that would pick whatever the newest 6.x is installed on the machine.
Please do use 6.0.403! It fixes a nasty bug with System.Globalization.AppLocalIcu which Umbraco uses (ps. the advertised .NET version number for that is 6.0.11, I don't know why the SDK / Core have a different version number).
.net 6 & 7 build/runtime pains
Apologies for this not being massively Umbraco specific, but i've just installed the final .net7 SDK along with a Visual Studio upgrade and now seem to be having some problems....
Upon re-opening my .net 6/Umbraco 10 project I can no longer use dotnet watch run and get the following error:
Unhandled exception. System.IO.FileNotFoundException: Could not find file or assembly 'System.Runtime, Version=7.0.0.0.
So, two things. 1. I'm not using .net7 in this project and 2. I have .net 7 installed and it's complaining I don't, but I guess it's because the project targets .net 6.
If I use dotnet build and dotnet build run....all is good! Any help much appreciated.
Hi Martin
This appears to be an issue with the .NET SDK. You can see an issue for it here: https://github.com/dotnet/sdk/issues/28942
For now, a solution could be adding a
global.json
file at the root of your project with the following content:This tells .NET to use a specific SDK rather than the newest. I think
6.0.403
is the newest version of .NET 6, but in my case, mine was a bit older. If you don't have the specified version,dotnet watch
will result in an error but also list of versions that you do have installed.Anders you star!
This had me scratching my head all afternoon, even after intense googling!
Thank you!
Martin
To make that
global.json
less version-specific you can do:So that would pick whatever the newest 6.x is installed on the machine.
Please do use
6.0.403
! It fixes a nasty bug withSystem.Globalization.AppLocalIcu
which Umbraco uses (ps. the advertised .NET version number for that is6.0.11
, I don't know why the SDK / Core have a different version number).is working on a reply...