so today i (again) had to solve an issue with a new build agent with VS tools installed and trying to build a .net core application using
dotnet publish myapp.csproj -r win10-x64 --framework netcoreapp3.1 --self-contained=false
wich would then fail with the following error. so i decided to blog this in case i have to solve it again ;)
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.PlatformAbstractions, Version=188.8.131.52, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
to resolve this i ran
dotnet --version wich gave me a 5.x version and
dotnet --list-sdks which gave me a 3.1 and a 5.0 sdk. should be OK right?
no… my current workaround is to move the “5.0” folder located in
Program Files\dotnet\sdk somwhere else. i cannot uninstall this sdk because it came
with VS and i have no idea how to remove it in there, the uninstaller just says “please use VS installer to remove this product.”
works now, hopefully i do not need to cross-compile 3.1 and 5.x at some point! :D