I just started getting this error today on my Linux system, building a net6
solution on Rider - It builds but won't run. I've tried upgrading my version of Microsoft.Data.SqlClient
from nuget but that's made no difference. This was working fine last week.
There are a couple of things I've done that may have broken it - I got mono working over the weekend to try and get some legacy NETFramework
code building for another project, for one. The other was a global update of ef tools dotnet tool update --global dotnet-ef
as I had the 5.x tools version installed.
My OS has multiple runtimes installed...
dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
The app builds to target 6.0.
I'm a bit lost as to where to start trying to find problems - I#ve read about the netstandard2.0
version of this library being a kind of breaking stub, but the Assembly Explorer in Rider tells me that the version of Microsoft.Data.SqlClient
in my bin
directory is net6
. I'm not sure what I should be seeing in the runtimes
directory in here - I have a unix
runtime shown there but NOT a linux specific runtime - Is this a red herring or am I on to something?
I've reverted the dotnet-ef tool by uninstalling it and running dotnet tool install --global dotnet-ef --version 5.0.0
- This hasn't helped at all.
I recommend to not install dotnet from the arch or AUR repositories at all. Instead use the script provided by Microsoft. This installs the original builds.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
I created this wrapper script which I use any time I need to install a machine:
#!/bin/bash
# This script installs specified versions of .NET Core and the latest LTS
# Function to install a specific .NET Core version
install_dotnet_version() {
local version="$1"
echo "Installing .NET Core version $version..."
curl --silent --show-error --location https://dot.net/v1/dotnet-install.sh \
| sudo bash /dev/stdin -c "$version" --install-dir /usr/share/dotnet
}
# Install .NET Core versions
install_dotnet_version 3.1
install_dotnet_version LTS
install_dotnet_version 7.0
# Create a symlink to dotnet executable, if not present
if [ ! -f /usr/bin/dotnet ]; then
sudo ln -sf /usr/share/dotnet/dotnet /usr/bin/dotnet
fi