How to use .NET Core 3.0 Preview8 with App Center Build - xamarin

I've implemented .NET Core 3.0 Preview 8 into my app, but now when I try to use App Center, I get this error message:
The current .NET SDK does not support targeting .NET Core 3.0
==============================================================================
Task : Command Line
Description : Run a command line with arguments
Version : 1.1.3
Author : Microsoft Corporation
Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
[command]/bin/bash -c /usr/bin/find . -name '*.sln' -type f -print0 | /usr/bin/xargs -0 grep -l 'MondayPundayApp.Droid.csproj' | /usr/bin/xargs -I '{}' nuget restore '{}' -DisableParallelProcessing
MSBuild auto-detection: using msbuild version '15.0' from '/Library/Frameworks/Mono.framework/Versions/6.0.0/lib/mono/msbuild/15.0/bin'.
/Users/vsts/hostedtoolcache/dotnet/sdk/2.2.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0. [/Users/vsts/agent/2.155.1/work/1/s/Src/MondayPundayApp.UnitTests/MondayPundayApp.UnitTests.csproj]
##[error]/bin/bash failed with return code: 1
##[error]/bin/bash failed with error: /bin/bash failed with return code: 1
Is there any way to use .NET Core 3.0 Preview 8 with App Center Build?

App Center Build doesn't currently support preview versions of .NET Core, but we can manually install .NET Core 3.0 Preview 8 using a post-clone script.
Here's a walkthrough I put together on the topic:
https://www.codetraveler.io/2019/08/23/using-preview-versions-of-net-core-with-app-center-build/
wget https://dot.net/v1/dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --version "3.0.100-preview8-013656" --install-dir "$AGENT_TOOLSDIRECTORY/dotnet"

Related

Failed to load /snap/dotnet-sdk/152/shared/Microsoft.NETCore.App/6.0.1/libcoreclr.so Error

Previously I installed the .Net Core 3.1.416 version and dotnet-ef 3.1.416 version.
I used
dotnet-ef migrations add Test -p <path to domain layer> -s <path to solution file> --context ApplicationDbContext
command to add a database migration
then I have to install the .Net core 6.0.101 version SDK for a new project. Then I upgrade dotnet-ef 6.0.101 version.
Then I add migration at the .Net 6.0 project or 3.1.416 it throws the following error
Failed to load /snap/dotnet-sdk/152/shared/Microsoft.NETCore.App/6.0.1/libcoreclr.so, error: /snap/dotnet-sdk/152/shared/Microsoft.NETCore.App/6.0.1/../../../lib/x86_64-linux-gnu/librt.so.1: undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
Segmentation fault (core dumped)
when I run dotnet --list-sdks command it shows the below output
3.1.416 [/usr/share/dotnet/sdk]
6.0.101 [/usr/share/dotnet/sdk]
Please help me to solve this problem
I installed Dotnet SDK 6.0 and 3.1 using the following link
Install multiple Dotnet versions
and I use global.json file to switch the sdks

dotnet run x.csproj "... libhostfxr.dylib could not be found."

Running a .NET Core project on a Mac with .NET 6.0 installed causes a strange error.
lukepuplett#Lukes-Air > ~/Documents/Git/Repo/src/Corp.App.Mvc > > master ± > dotnet run Corp.App.Mvc.csproj
A fatal error occurred. The required library libhostfxr.dylib could not be found.
If this is a self-contained application, that library should exist in [/Users/lukepuplett/Documents/Git/Repo/src/Corp.App.Mvc/bin/Debug/net5.0/].
If this is a framework-dependent application, install the runtime in the global location [/usr/local/share/dotnet/x64] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].
The .NET runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=osx.11.1-x64&apphost_version=5.0.12
Note that the project builds fine.
macOS Monterey, Apple Silicon M1 and .NET 6.0 is installed.
This can occur when the project is targeting an older .NET Core version. The error is confusing because the project may build okay, and you'd expect a more accurate message.
A better message can be seen when executing the compiled binary directly, see below.
lukepuplett#Lukes-Air > ~/Documents/Git/Repo/src/Corp.App.Mvc/bin/Debug/net5.0 > > master ± > dotnet Corp.App.Mvc.dll
It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '5.0.0' (arm64) was not found.
- The following frameworks were found:
6.0.0 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=5.0.0&arch=arm64&rid=osx.11.1-arm64
The problem can happen when you've pulled down code from a Git repo that is targeting .NET Core 5, for example.

Where should I put ASP.NET Core Runtime binaries?

Some example code I'm playing with informs me that I need ASP.NET Core Runtime 2.1.14. I found it here. I'm on macOS and there is no installer, so I downloaded the "binaries" at the link "x64" under the heading "ASP.NET Core Runtime 2.1.14" on the right. I extracted the compressed folder, called "aspnetcore-runtime-2.1.14-osx-x64", which has the following contents:
dotnet
host
LICENSE.txt
shared
ThirdPartyNotices.txt
Now, I haven't the foggiest idea what I should do with these to install ASP.NET Core Runtime 2.1.14. Could someone please tell me what I should do?
To build and run ASP.NET Core apps on macOS, you need to install the SDK which also contains the runtime. There's an installer for that on the page you linked.
You can check the installed SDKs using dotnet --list-sdks and see where are they located. Same goes for the runtimes with dotnet --list-runtimes. The .NET CLI chooses the SDK version for each dotnet command, so in your case it will pick the one compatible with the version specified in your project. By default, it would use the latest.
There is an installer for MacOS on the download page for 2.1 you visited:
Make sure to download the SDK (it includes the Runtime) in the column Installers, not Binaries.
Then install it as any MacOS application. Once you did it, you can type dotnet --version in a terminal and it will return the version you just installed.

netcore web app - It was not possible to find any compatible framework version

I'm trying to use VSCode with .Net Core web applications but I'm stuck at the begining. I installed dotnet sdk 2.0.2 and I created a web application by using yeoman.
I used dotnet restore command and after that I used dotnet run command. But on dotnet run command it keeps saying 'can't find any compatible framework version'. Check the error below.
So how can I run my web app? I tried to change version too but I had same results.
Using launch settings from /Users/kadir/Documents/Development/WebApplications/firstMvcTutorial/firstMvcCoreWebApp/Properties/launchSettings.json...
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '1.0.5' was not found.
- Check application dependencies and target a framework version installed at:
/
- Alternatively, install the framework version '1.0.5'.
Solved it.
I downloaded and installed Microsoft.NETCore.App 1.0.5 from this link.
After that I changed version to 2.0.0 on global.json. Then I restored dotnet with dotnet restore and I run app with dotnet run.
But this time I had a problem with System.Security.Cryptography.Native.
.
I applied commands below and fixed my problem. Now I can run my web application.
brew update
brew install openssl
mkdir -p /usr/local/lib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

Where is the default .NET Core SDK path in MacOS

I've recently installed the .NET Core SDK for MacOS in order to create a demo application using the new JetBrains Rider EAP.
Project 'WebApi' load failed
Can't initialize DotNetCore: Please select DotNet Core SDK path.
To get instructions how to setup visit https://www.microsoft.com/net/download/core
After the installation I tried to find the path to the DotNet Core SDK without success.
Any idea about the location of the .NET Core SDK?
Try this path: /usr/local/share/dotnet/dotnet
It took some time to find it:
find / -name dotnet
If you run this in your terminal, it will list the installed SDK's and their locations. I believe it works in windows as well
dotnet --list-sdks
For me it was:
/System/Volumes/Data/Users/$USER/.dotnet
Also, tips, if you run find / -name dotnet do it like:
find / -name dotnet 2>/dev/null
That way you don't get any permissions errors just real hits.

Resources