Skip to content

Instantly share code, notes, and snippets.

@omajid
Last active April 26, 2024 16:31
Show Gist options
  • Save omajid/3d77dd8c8a61ef24494a12323c8e94fb to your computer and use it in GitHub Desktop.
Save omajid/3d77dd8c8a61ef24494a12323c8e94fb to your computer and use it in GitHub Desktop.
There's a bunch of environment variables that need to be set up for this to work correctly.
In particular, you need to set DOTNET_ROOT to point to your .NET installation.
If you are using Fedora's packages for .NET, it's all done for you, but you need to log
out and then back in after installing .NET packages. Here's an example:
```
# Use container to simulate a fresh install
$ podman run -it fedora:40
Resolved "fedora" as an alias (/etc/containers/registries.conf.d/000-shortnames.conf)
Trying to pull registry.fedoraproject.org/fedora:40...
Getting image source signatures
Copying blob 0091ef30bf40 done |
Copying config 2ecd175602 done |
Writing manifest to image destination
[root@a9262322f89a /]# dnf install -yq dotnet-sdk-8.0
Installed:
aspnetcore-runtime-8.0-8.0.4-1.fc40.x86_64 aspnetcore-targeting-pack-8.0-8.0.4-1.fc40.x86_64 dotnet-apphost-pack-8.0-8.0.4-1.fc40.x86_64
dotnet-host-8.0.4-1.fc40.x86_64 dotnet-hostfxr-8.0-8.0.4-1.fc40.x86_64 dotnet-runtime-8.0-8.0.4-1.fc40.x86_64
dotnet-sdk-8.0-8.0.104-1.fc40.x86_64 dotnet-targeting-pack-8.0-8.0.4-1.fc40.x86_64 dotnet-templates-8.0-8.0.104-1.fc40.x86_64
libicu-74.2-1.fc40.x86_64 netstandard-targeting-pack-2.1-8.0.104-1.fc40.x86_64
[root@a9262322f89a /]# dotnet --info
.NET SDK:
Version: 8.0.104
Commit: 034f91fcc0
Workload version: 8.0.100-manifests.cd97f1c9
Runtime Environment:
OS Name: fedora
OS Version: 40
OS Platform: Linux
RID: fedora.40-x64
Base Path: /usr/lib64/dotnet/sdk/8.0.104/
.NET workloads installed:
Workload version: 8.0.100-manifests.cd97f1c9
There are no installed workloads to display.
Host:
Version: 8.0.4
Architecture: x64
Commit: 2d7eea2529
.NET SDKs installed:
8.0.104 [/usr/lib64/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.4 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.4 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
None
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
[root@a9262322f89a /]# dotnet tool install -g dotnet-ef
Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.104
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Skipping NuGet package signature verification.
Tools directory '/root/.dotnet/tools' is not currently on the PATH environment variable.
If you are using bash, you can add it to your profile by running the following command:
cat << \EOF >> ~/.bash_profile
# Add .NET Core SDK tools
export PATH="$PATH:/root/.dotnet/tools"
EOF
You can add it to the current session by running the following command:
export PATH="$PATH:/root/.dotnet/tools"
You can invoke the tool using the following command: dotnet-ef
Tool 'dotnet-ef' (version '8.0.4') was successfully installed.
[root@a9262322f89a /]# dotnet ef --help
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
[root@a9262322f89a /]# dotnet-ef --help
bash: dotnet-ef: command not found
# Simulate a login/logout by running a new instance of bash
[root@a9262322f89a /]# bash
[root@a9262322f89a /]# dotnet ef --help
Entity Framework Core .NET Command-line Tools 8.0.4
Usage: dotnet ef [options] [command]
Options:
--version Show version information
-h|--help Show help information
-v|--verbose Show verbose output.
--no-color Don't colorize output.
--prefix-output Prefix output with level.
Commands:
database Commands to manage the database.
dbcontext Commands to manage DbContext types.
migrations Commands to manage migrations.
Use "dotnet ef [command] --help" for more information about a command.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment