question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Installing the dotnet 7 SDK on Ubuntu Jammy seems to only install the runtime.

See original GitHub issue

Describe the bug

On Ubuntu 22.04 LTS, dotnet build stopped working after the latest package updates. I removed the SDK and when reinstalling it, it seems to install the runtime and not the SDK, is it possible a package is mistagged?

Edit: it does install it, but in the wrong location (or missing an environment var).

To Reproduce

Have a ubuntu 22.04 (Jammy Jellyfish), without dotnet installed (in my case, after sudo apt remove 'dotnet*' 'aspnet*' 'netstandard*'). (I’ve never installed dotnet 6 on here, in case that matters).

Then attempt to install the latest dotnet 7 SDK

wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
&& dpkg -i packages-microsoft-prod.deb
&& rm packages-microsoft-prod.deb
&& apt update
&& apt install -y dotnet-sdk-7.0

Then run dotnet --info and see that No SKDs were found (but there is a runtime).

Exceptions (if any)

Before attempting to remove and reinstall the SDK, when running dotnet build I got an error that went something like “You must install or update .NET to run this application.”.

Further technical details

Running dotnet --info gives:

Host:
  Version:      7.0.5
  Architecture: x64
  Commit:       8042d61b17

.NET SDKs installed:
  No SDKs were found.

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.5 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/lib/dotnet]

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

I’m running this from the command line (bash).

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Reactions:2
  • Comments:28 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
fhintschcommented, May 26, 2023

The SDK is in the package but the search path used by dotnet is wrong.

I helped myself with this line

for f in /usr/share/dotnet/* ; do ln -s $f /usr/lib/dotnet ; done

2reactions
Mattias1commented, Jun 6, 2023

Ah, that explains things. So if I understand it correctly this is what happened for me:

  • I installed dotnet 7 on ubuntu jammy, using the ms package, as that was the only option for dotnet 7 back then. I didn’t do any of the ‘special multiple sources things’, as there was only one source.
  • Now, dotnet 7 is released via ubuntu’s feed, and so there are now two sources, which means I need to do the ‘multiple sources things’
  • I didn’t because I wasn’t aware of this, and boom

So uninstalling dotnet again, removing the ms package source and reinstalling via the ‘normal’ ubuntu source and everything works as expected. Slightly confusing as I don’t check twitter often anymore these days, but very cool that it’s available via the offical feed now!

For as far as I’m concerned this issue can be closed. Not sure if this is the same for any of the other people commenting though.

Thanks to Rich Lander and Chet Husk for looking into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ubuntu .Net 7 Install Can't Find SDK
NET packages from two different providers - the runtime is from the Ubuntu repository (and installs at /usr/lib/dotnet) while the SDK is ...
Read more >
Why don't any of these methods work for installing .Net ...
I make it run with the APT package solution, in fact there is a conflict between Ubuntu packages (Jammy feed) and Microsoft Package...
Read more >
Install .NET SDK or .NET Runtime on Ubuntu 22.04
This article discusses how to install .NET on Ubuntu 22.04; .NET 6 and .NET 7 are supported. Install the SDK (which includes the...
Read more >
How do I run the .NET SDK? The SDK and runtime appear ...
NET SDKs installed : No SDKs were found. .NET runtimes installed: Microsoft.AspNetCore.App 7.0.5 [/usr/lib/dotnet/shared/Microsoft.
Read more >
How to Install .NET Core (dotnet) on Ubuntu 22.04
This tutorial walks through installing the .NET core on Ubuntu 22.04 LTS Linux system. You can install .NET Core SDK or set up...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found