MicrosoftDocs / mslearn-tailspin-spacegame-web

Code used in Microsoft Learn modules to support Azure DevOps
https://aka.ms/devops-build
Creative Commons Attribution 4.0 International
179 stars 27.22k forks source link

Error: dotnet command not found in GitHub Codespace instance #7986

Open kbhpe opened 4 months ago

kbhpe commented 4 months ago

During exercise step "Build and run the web app" in Exercise - Get the sample application (https://learn.microsoft.com/en-us/training/modules/create-a-build-pipeline/) while running dotnet build --configuration Release receiving error "command not found".

mplac555 commented 3 months ago

Hey! Where you able to figure this out?

DISCLAIMER: Though I'm working in getting better, I'm currently really an IT noob when it comes to advanced stuff like this, so I exhort anyone who sees this who is more knowledgeable in these topics than me to confirm or correct this answer !!

I was also following the instructions from the Exercise - Get the sample application of the Create a build pipeline with Azure Pipelines lesson, and encountered the same error.

I solved this problem in my particular scenario by performing the following actions:

First, I followed the steps to install .NET on Linux, explained in this Microsoft Documentation post; specifically, I chose the scripted install path.

This post tells you to execute the following bash commands in the Codespaces terminal:

wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh chmod +x ./dotnet-install.sh ./dotnet-install.sh --version latest

Again, each command is properly explained and justified in the mentioned documentation

The previous series of commands effectively install the latest .NET SDK, after which it's necessary to add dotnet to the system PATH. To do that, I executed the following commands, which I got from this other Ms post:

export DOTNET_ROOT=$HOME/.dotnet export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools

Then, I got an error stating something like the following:

Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu (or icu-libs) using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-1ibicu for more information.

I solved this by executing the following command, as proposed by the user nt86 in this Stackoverflow post:

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1

After this, I was able to execute the instructions that needed the dotnet command !

As I commented in the disclaimer above, I'm not an expert an therefore I'm not sure of all the repercussions of this last command, so beware. Also, by the way, I did everything I mentioned in the desktop version of VS Code (on Windows 10), rather than directly on the browser.

This is the first time I try and help in a forum, so I'd appreciate any sort of feedback! :)

tinybitofheaven commented 2 months ago

@mplac555's solution worked for me! However, to get the rest of the steps to work, I had to specify version 6.0 instead of the latest version.

./dotnet-install.sh --channel 6.0

arelben commented 4 weeks ago

Thanks @mplac555, your solution works great. But now, when I try to open the web project on port 5000 It shows "Page not found"