Is it impossible to build a .net5 app on Azure Pipelines now? - azure

We are getting this error:
Detecting platforms...
Error: Platform 'dotnet' version '5.0' is unsupported. Supported versions: 3.1.10, 3.1.11, 3.1.12, 3.1.13, 3.1.15, 3.1.17, 3.1.18, 3.1.21, 3.1.23, 3.1.25, 3.1.26, 3.1.28, 3.1.29, 3.1.31, 6.0.0-preview.1.21102.12, 6.0.0-preview.2.21154.6, 6.0.0-preview.3.21201.4, 6.0.0-preview.4.21253.7, 6.0.0-preview.5.21301.5, 6.0.0-preview.6.21352.12, 6.0.0-preview.7.21377.19, 6.0.0-rc.1.21451.13, 6.0.0-rc.2.21480.5, 6.0.0, 6.0.3, 6.0.5, 6.0.6, 6.0.8, 6.0.9, 6.0.11, 7.0.0-preview.1.22076.8, 7.0.0-preview.5.22301.12, 7.0.0-preview.6.22324.4, 7.0.0-preview.7.22375.6, 7.0.0-rc.1.22426.10, 7.0.0-rc.2.22472.3, 7.0.0, 1.0.16
If we upgrade our app to .net6 (changing nothing else) it will build fine but then the resulting app is incompatible with all the other .net5 apps it needs to talk to.
Is there a solution to this other than having to upgrade everything to .net6?

Related

"System.PlatformNotSupportedException: Microsoft.Data.SqlClient is not supported on this platform." on Linux

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.
TLDR: I think this is a bug in the .NET builds of Manjaro Linux. When you downloaded Microsoft's builds of .NET, it didn't have this bug and worked correctly.
This is what the OS says about itself:
# cat /etc/os-release
NAME="Manjaro Linux"
PRETTY_NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
BUILD_ID=rolling
ANSI_COLOR="32;1;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://forum.manjaro.org/"
BUG_REPORT_URL="https://docs.manjaro.org/reporting-bugs/"
PRIVACY_POLICY_URL="https://manjaro.org/privacy-policy/"
LOGO=manjarolinux
And this is what .NET thinks about your OS:
sh-5.1# dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.113
Commit: 4a23b50f97
Runtime Environment:
OS Name: manjaro
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /usr/share/dotnet/sdk/6.0.113/
...
Do you see how confused .NET is about whether this is Arch Linux or Manjaro?
.NET has a fallback graph that tells it which assets from another OS it can use:
# jq '.runtimes' /usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.13/Microsoft.NETCore.App.deps.json
{
"arch-x64": [
"arch",
"linux-x64",
"linux",
"unix-x64",
"unix",
"any",
"base"
]
}
But that only contains arch-x64 (that is, Arch Linux), not manjaro-x64.
If you try and build/run your application with the environment variable COREHOST_TRACE, you can see output like this:
HostRID is manjaro-x64
Falling back to base HostRID: linux-x64
So it finally decides this OS is Manjaro, but then has no idea that Manjaro is compatible with everything listed in the fallback graph above. It just falls back to Linux.
Unfortunately, Microsoft.Data.SqlClient is built for either Windows (windows) or for Unix (unix). .NET can't find a linux variant. It finally uses the fallback version of Microsoft.Data.SqlClient.dll, one that just prints errors instead of doing anything useful.
It seems that the issue was, in part, related to having 2 6.x framework versions installed, or with 6.0.13 - I'd tried installing the 6.x packages from the Manjaro repositories over the weekend to replace the script installs.
Dani's comment above pointed me in the right direction (https://github.com/dotnet/SqlClient/issues/1643#issuecomment-1265104713) - There's something odd going on here.
I removed them all and installed again using the .dotnet-install.sh script - that just did nothing, so I copied the 6.0.0 install from a backup folder (mv .old FTW) and it all fell into place again.
Whether this is an issue with 6.0.13 or with having multiples I'm not sure.

While upgrading ES to version 5.6.16 throws error plugin [repository-s3] is incompatible with version [5.6.16]; was designed for version [5.2.0]

While upgrading ES to version 5.6.16, did a system restart for the new version to take effort.
Tried to get ES version, for which it said connection refused.
Then when I manually start elastic search throws error
plugin [repository-s3] is incompatible with version [5.6.16]; was designed for version [5.2.0]
This repository plugin is used for snapshot/restore solution. To run it please upgrade plugin also to 5.6.16 version
sudo ./elasticsearch-plugin install -b file:///pathToPluginZipFile/repository-s3-5.6.16.zip
What worked for me is that I uninstalled the repository-s3
Then reinstalled it. Then I manually started the ES and it worked.

error NU1102: Unable to find package NuGet.Frameworks with version (>= 4.9.3)

I'm getting this error when I try to build a .NET Core solution with Azure DevOps:
error NU1102: Unable to find package NuGet Frameworks with version (>= 4.9.3)
error NU1102: - Found 33 version(s) in http://nuget.bentley.com/nuget/Default [ Nearest version: 4.7.0-preview1-4986 ]
The error occurs in the Cake script when a NuGet restore is being executed by dotnet.exe CLI:
Executing: "d:/vsts/a/_tool/dncs/2.2.100/x64/dotnet.exe" restore "./src/StorageRegistryPortal.sln" --source "http://nuget.bentley.com/nuget/Default"
It tries to restore the NuGet packages from the solution file before throwing the NU1102 error above:
Restoring packages for d:\vsts\a\2921\s\src\StorageRegistryPortal\StorageRegistryPortal.csproj...
Nothing in my solution is referencing this "NuGet.Frameworks" package. So, I wonder if it is the "dotnet.exe" CLI itself that depends on this nuget package before it can restore the rest of the NuGet packages. Also, this only happens in AzureDevops. When I execute the build/cake script on my local PC, it is able to successfully restore all of the nuget packages with no issues.
I've already tried adding a "Use Nuget 4.9.3" task to the build pipeline, but I get the same error.
NOTE: If I remove that "Use Nuget 4.9.3" task, then the error changes to (>= 4.7.0). So, it appears to be looking for the Nuget.Framework that matches the current version of nuget.exe but not finding it.
Here is the screenshot of my build pipeline setup:
TL;DR
This sometimes happens when running dotnet restore on one of my Linux/Ubuntu build servers when pulling from a private Azure DevOps Artifacts/Packages NuGet repo.
The solutions that work for me:
Rebooting the Linux machine, or
Deleting the NuGet cache at ~/.local/share/NuGet/v3-cache/[directory-with-name-of-my-private-nuget-repo]
Background
The error I get is:
error NU1102: Unable to find package [Name-of-my-custom-nuget-package] with version (>= 5.0.116)
I have a nuget.config file that is properly configured to pull down my NuGet packages.
The error is complete nonsense.
The version does exist
Other Linux boxes have no problems running dotnet restore and getting the version of the package
I can run dotnet restore on the same Linux machine for other (older) versions and it's fine
It just seems that dotnet restore decides, for whatever reason, that it's not even going to try to look for the new version of the package.
I've generally found Azure DevOps private NuGet repos secured with AAD to be especially problematic and annoying when dealing with Linux. It really needs some love and attention from the NuGet team.
I was finally able to resolve this issue. It turns out there was a breaking change from the nuget.org folks which caused our internal nuget server to fail to serve the 4.7 and 4.9.3 versions of NuGet.Frameworks. This is an essential nuget library which is required by dotnet.exe to restore nuget packages. For .net core projects, that framework needs to be version 4.7 or higher. Anyway, the resolution was that we had to make adjustments to our internal nuget server to account for the changes from nuget.org.
Could you please have a try to use Nuget 4.9.1 as screenshot then run your build again?
Hope it helps.
Try to download Nuget.Framework of higher version from here https://www.nuget.org/downloads.
In my case it was a problem with version 5.0.0 and I installed 5.0.2 then error disappeared.

`dotnet new command` in openSuse causes `No usable version of the libssl was found` error

I'm trying to develop .NET Core in openSuse. I did install the SDK and everything in tutorials. Now, when I try to run dotnet new console command, I get this error:
No usable version of the libssl was found
Aborted (core dumped)
I found this answer: (.NET Core 2.1 SDK Linux x64 No usable version of the libssl was found), but didn't get what should I do to solve problem. They seems are deep-linuxer (which I'm not, I'm just trying to learn linux). Have any idea how to run the command?
UPDATE: System info:
openSUSE Leap 15.0
Kernel Version 4.12.14-lp150.12.22-default
OS Type:64-bit
I was having the same problem running sqlpackage on Ubuntu 20.04 while dotnet was working regularly.
dotnet is distributed through apt as well as sqlserver, but for some reasons sqlpackage is instead distributed via zip here (https://learn.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-ver15) and is still affected by missing libssl1.0.
Solved with
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.6_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.6_amd64.deb
Can you install the libopenssl1_0_0 packages? .NET Core should pick it up and use it.
A slightly longer explanation for anyone who is curious:
OpenSSL is one of the most common cryptographic libraries used on Linux. It has multiple versions. Version 1.0 is kind of old, but heavily used. 1.1 is the newer version that was (relatively) recently released. 1.0 and 1.1 are not compatible. An application that expects 1.0 can not build against 1.1, nor run against it.
.NET Core 2.1, and all earlier versions only support OpenSSL 1.0.
Many Linux distributions are starting to make OpenSSL 1.1 the new default. But most of them still have a package for 1.0. So you just need to find and install that. On Fedora it's compat-openssl10. For openSuSE, it's libopenssl1_0_0. Then .NET Core will find it, pick it up and use it automatically.
Edit: As of March 2019, this shouldn't be required. We have updated .NET Core 2.1 and later to pick up and work with either OpenSSL 1.1 or 1.0 (whatever is available). So this problem should no longer happen with recent releases of .NET Core.
Ubuntu 22.04
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
Still get this on Fedora 30 (with compat-openssl10 installed) when using the sqlpackage tool (https://learn.microsoft.com/en-us/sql/tools/sqlpackage-download?view=sql-server-2017).
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.203
Commit: e5bab63eca
Runtime Environment:
OS Name: fedora
OS Version: 30
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/2.2.203/
Host (useful for support):
Version: 2.2.4
Commit: f95848e524
.NET Core SDKs installed:
2.2.203 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Dotnet works fine on it's own. But running sqlpackage does not work:
$ sqlpackage /tsn:localhost /tu:xx /tp:yyy /A:Import /tdn:mydb /sf:mydb.bacpac
Importing to database 'mydb' on server 'localhost'.
No usable version of the libssl was found
Aborted (core dumped)
I looking up "No usable version of the libssl was found" in github. You'll find many variants of the .Net core security library in C, each varient has very specific dll loads for exact libssl libraries and everything has to match perfect despite it being named differently in many.
For raspberry pi / debian it wants libssl 1.0.2 exactly, nothing else.
sudo apt-get install libssl1.0.2
should do the trick for the pi! I can't speak to other variants.

dep0810 microsoft.winjs.1.0 and higher version in my machine

This app references Microsoft.WinJS.1.0, version 1.0.8514.0, found in your SDK, but you have a higher version of Microsoft.WinJS.1.0 installed on the target machine, 1.0.9200.20602. If you continue to run this application, it will run against the currently installed version, Microsoft.WinJS.1.0, version 1.0.9200.20602. Consider updating your SDK to match the version of Microsoft.WinJS.1.0 that is installed.

Resources