Reputation: 1871
We have an app, written in .NET Core rc2 running on an acceptance environment (linux server). Recently our client ran their own performance tests, which turned out to completely break the application. We couldn't reproduce it ourselves for several reasons:
On windows, we couldn't reproduce in either our new version (1.0.0) or rc2. So we tried to reproduce it on a linux machine. on 1.0.0 we couldn't reproduce their results either, but when we tried to actually test against rc2 (an older version of our app, obviously) we ran into a really annoying problem: I don't seem to be able to install 1.0.0 and rc2 side by side, even though the error message implies it's possible. Below is the error message
The specified framework 'Microsoft.NETCore.App', version '1.0.0-rc2-3002702' was not found.
- Check application dependencies and target a framework version installed at:
/usr/share/dotnet/shared/Microsoft.NETCore.App
- The following versions are installed:
1.0.0
- Alternatively, install the framework version '1.0.0-rc2-3002702'.
Basically, we want to be able to check the version currently running on acceptance of our app (rc2) on a linux machine, but we are struggling with actually getting rc2 on it.
Thanks. If anything is unclear, post your question in the comments.
EDIT: I tried building it as a standalone deployment, but then I get the following error:
Errors in /home/nicolaas/Projects/digipolis-survey-engine/Digipolis.FormEngine/Digipolis.FormEngine.Response.API/project.json
System.AppContext 4.1.0-rc2-24027 provides a compile-time reference assembly for System.AppContext on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with ubuntu.15.10-x64.
System.Runtime.InteropServices.RuntimeInformation 4.0.0-rc2-24027 provides a compile-time reference assembly for System.Runtime.InteropServices.RuntimeInformation on .NETCoreApp,Version=v1.0, but there is no run-time assembly compatible with ubuntu.15.10-x64.
One or more packages are incompatible with .NETCoreApp,Version=v1.0 (ubuntu.15.10-x64).
This is to be expected as rc2 is actually not installed on the machine, and I want to build it on the linux machine
Upvotes: 45
Views: 53815
Reputation: 11
download the dotnet 7 to : ~/dotnet7
just do the following, you will succeed, No thanks.
cp -r ~/dotnet7/shared/Microsoft.AspNetCore.App/7.0.19 /usr/lib/dotnet/shared/Microsoft.AspNetCore.App
cp -r ~/dotnet7/shared/Microsoft.NETCore.App/7.0.19 /usr/lib/dotnet/shared/Microsoft.NETCore.App
cp -r ~/dotnet7/sdk/7.0.409/ /usr/lib/dotnet/sdk
Upvotes: 1
Reputation: 253
sudo apt install dotnet
/usr/lib/dotnet
To do that you can check the output of whereis dotnet
for example.sdk
and shared
from unpacked archive into /usr/lib/dotnet/...
. So it should looks like~$ ls /usr/lib/dotnet/sdk
6.0.415 7.0.112 8.0.100-rc.1.23463.5
dotnet sdk check
. You will see something like~$ dotnet sdk check
.NET SDKs:
Version Status
------------------------------------------------------------------
6.0.415 Up to date.
7.0.112 Up to date.
8.0.100-rc.1.23463.5 Patch 8.0.100-rc.2.23502.2 is available.
Try out the newest .NET SDK features with .NET 8.0.100-rc.2.23502.2.
.NET Runtimes:
Name Version Status
---------------------------------------------------------------------------------------------
Microsoft.AspNetCore.App 6.0.23 Up to date.
Microsoft.NETCore.App 6.0.23 Up to date.
Microsoft.AspNetCore.App 7.0.12 Up to date.
Microsoft.NETCore.App 7.0.12 Up to date.
Microsoft.NETCore.App 8.0.0-rc.1.23419.4 Patch 8.0.0-rc.2.23479.6 is available.
Microsoft.AspNetCore.App 8.0.0-rc.1.23421.29 Patch 8.0.0-rc.2.23479.6 is available.
Enjoy!
Upvotes: 3
Reputation: 11483
I have .Net 6
installed on my Ubuntu 22.04 and needed .Net 5
to be installed side-by-side. After downloading .Net 5 SDK
, I uncompressed the downloaded file and tried to put it in the path just like 'Mohammad HS Farvashani. solution.
But the path did not work. I mean calling dotnet -v
was showing 6 everywhere. Additionally, dotnet --list-sdks
just showed 6.
My work-around was to call the dotnet 5
from its installation directory only. Just like this:
~/dotnet5/dotnet run
It helped me to run a .Net 5 application and it was enough for my purpose.
Consider that before it getting to run I encountered error
No usable version of libssl was found
This error resolved by running:
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.9_amd64.deb
sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.9_amd64.deb
from this answer.
Upvotes: 2
Reputation: 3126
Based on Mohammad's answer (which worked well), here is a more complete example installing dotnet 5 and 3.1 side by side:
env DOTNET_ROOT=/usr/share/dotnet
env PATH=$PATH:usr/share/dotnet
env DOTNET_SDK_VERSION=5.0.401
env DOTNET_SDK_VERSION2=3.1.413
curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
&& dotnet_sha512='a444d44007709ceb68d8f72dec0531e17f85f800efc0007ace4fa66ba27f095066930e6c6defcd2f85cdedea2fec25e163f5da461c1c2b8563e5cd7cb47091e0' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& mkdir -p /usr/share/dotnet \
&& tar -zxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
#&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
# Trigger first run experience by running arbitrary cmd
&& dotnet help
curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.413/dotnet-sdk-3.1.413-linux-x64.tar.gz \
&& dotnet_sha512='2a0824f11aba0b79d3f9a36af0395649bc9b4137e61b240a48dccb671df0a5b8c2086054f8e495430b7ed6c344bb3f27ac3dfda5967d863718a6dadeca951a83' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
#&& mkdir -p /usr/share/dotnet31 \
&& tar -ozxf dotnet.tar.gz -C /usr/share/dotnet \
&& rm dotnet.tar.gz \
#&& ln -s /usr/share/dotnet31/dotnet /usr/bin/dotnet31 \
# Trigger first run experience by running arbitrary cmd
&& dotnet help
Upvotes: 0
Reputation: 655
Download the tar.gz package from https://dotnet.microsoft.com/download/dotnet and install the package with this command:
mkdir -p $HOME/dotnet && tar zxf dotnet-sdk-6.0.100-preview.3.21202.5-linux-x64.tar.gz -C $HOME/dotnet
export DOTNET_ROOT=$HOME/dotnet
export PATH=$PATH:$HOME/dotnet
the scound version will be added to sdks folder and you can confirm the installation by running:
dotnet --list-sdks
I have found all the other solutions useless and hard to utilize and dotnet-install script is just very hard to use and pointless.
Upvotes: 19
Reputation: 839
Simply use the dotnet install
script: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
This is a good tutorial: https://www.hanselman.com/blog/SideBySideUserScopedNETCoreInstallationsOnLinuxWithDotnetinstallsh.aspx
Upvotes: 14
Reputation: 437
This has been working for us.
Installing multiple versions of dotnet runtime to separate directories.
For the latest runtime installation, add symlinks for each of the older runtimes. For example, for older runtime 1.1.2 we create the symlink /path/to/dotnet-latest/shared/Microsoft.NETCore.App/1.1.2 --> /path/to/dotnet-1.1.2/shared/Microsoft.NETCore.App/1.1.2
Run dotnet from the latest runtime installation and it should pick up the appropriate runtime.
Note that this is equivalent to what happens with the Windows installer. The new runtime is added to the shared installation. A similar approach can be used to get support for multiple sdks from a single installation by adding the appropriate symlinks in the sdk subdirectory.
Upvotes: 4