简体   繁体   中英

How to fix "Segmentation fault (core dumped)" when creating new dotnet project?

I am following https://do.net.microsoft.com/learn/do.net/hello-world-tutorial/create

When I try to create a project, I get the following:

oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ dotnet new console -o MyApp
Segmentation fault (core dumped)

I have installed do.net 5.0 via snap using:

sudo snap install dotnet-sdk --classic --channel=5.0
sudo snap alias dotnet-sdk.dotnet dotnet

Snap information:

oskar@oskarslaptop:~/Programming/Resorvoir-CLI$ sudo snap info dotnet-sdk 
name:      dotnet-sdk
summary:   Develop high performance applications in less time, on any platform.
publisher: Microsoft .NET Core (dotnetcore✓)
store-url: https://snapcraft.io/dotnet-sdk
contact:   https://dot.net/core
license:   unset
description: |
  .NET Core is the modular and high performance implementation of .NET for creating web applications
  and services that run on Windows, Linux and Mac. It is open source and it can share the same code
  with .NET Framework and Xamarin apps.
  
  .NET Core is a .NET Foundation project. https://dotnetfoundation.org/
commands:
  - dotnet-sdk.dotnet
snap-id:      uHc4y9lWxyqYfxsqcr4xILzAai4L1BHs
tracking:     5.0/stable
refresh-date: today at 13:36 BST
channels:
  latest/stable:    5.0.302                   2021-07-13 (132) 139MB classic
  latest/candidate: ↑                                                
  latest/beta:      ↑                                                
  latest/edge:      5.0.202                   2021-04-16 (120) 137MB classic
  lts/stable:       3.1.411                   2021-07-13 (133) 123MB classic
  lts/candidate:    ↑                                                
  lts/beta:         ↑                                                
  lts/edge:         ↑                                                
  6.0/stable:       –                                                
  6.0/candidate:    –                                                
  6.0/beta:         6.0.100-preview.6.21355.2 2021-07-14 (134) 144MB classic
  6.0/edge:         ↑                                                
  5.0/stable:       5.0.302                   2021-07-13 (132) 139MB classic
  5.0/candidate:    ↑                                                
  5.0/beta:         5.0.100                   2020-11-10 (105) 267MB classic
  5.0/edge:         ↑                                                
  3.1/stable:       3.1.411                   2021-07-13 (133) 123MB classic
  3.1/candidate:    ↑                                                
  3.1/beta:         ↑                                                
  3.1/edge:         ↑                                                
  2.1/stable:       2.1.816                   2021-05-11 (124) 245MB classic
  2.1/candidate:    ↑                                                
  2.1/beta:         ↑                                                
  2.1/edge:         2.1.808                   2020-07-14  (91) 245MB classic
installed:          5.0.302                              (132) 139MB classic

我的系统(我无法嵌入图像)

I get 'Segmentation fault (core dumped)' with.Net 6.0 (do.net build) on Ubuntu 22.04. After downgrade to Ubuntu 20.04. 'do.net build' works well

I think this is the issue in snap itself. Instead of snap , use pacman

sudo snap remove dotnet-sdk
sudo pacman -S dotnet-sdk

More info of this issue is here https://github.com/dotnet/sdk/issues/11639

POP OS is based on Ubuntu. If you installed the dotnet runtime via snap install you can access it via "sudo dotnet ..." only. I had the same problem in VS Code, it runs the dotnet commands without sudo and I recived the "Segmentation fault (core dumped)" error. I solved by installing the dotnet runtime via apt-get (now is installed in "/usr/bin ..." and works without sudo (see: https://docs.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#2004- ))

7.0.100-preview.5.22307.18 worked for me in Ubuntu 22.04 when I download the gzip file & extract it to a folder & called the folder location from the command line

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM