Share via

How to fix Fatal error while creating dotnet c# project

AsynchronousTexx 229 0 Reputation points
2023-12-15T12:07:53.02+00:00

Hello, I'm new in C#, yesterday, I have installed C# .NET Framework, and now, I need to create new project, but when I type

dotnet new console

I have getting this error:

Fatal error. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.    at System.Globalization.CompareInfo.Compare(System.ReadOnlySpan`1<Char>, System.ReadOnlySpan`1<Char>, System.Globalization.CompareOptions)    at System.Globalization.CompareInfo.Compare(System.String, System.String, System.Globalization.CompareOptions)    at System.String.Equals(System.String, System.StringComparison)    at Microsoft.DotNet.Cli.Utils.UILanguageOverride.Setup()    at Microsoft.DotNet.Cli.Program.Main(System.String[])

Please, help me, I don't know, how to fix that.

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


1 answer

Sort by: Most helpful
  1. Anonymous
    2023-12-18T02:45:24.5933333+00:00

    Hi @AsynchronousTexx 229 , Welcome to Microsoft Q&A,

    You can choose to use a command line or you can use the compiler to create it directly.

    1.Create a directory first

    mkdir testProject
    cd testProject
    dotnet new console

    edit program.cs then

    dotnet run

    1. https://github.com/dotnet/docs/blob/main/docs/core/tutorials/with-visual-studio.md

    Create a .NET console app project named "HelloWorld".

    Start Visual Studio 2022.

    On the start page, choose Create a new project.

    On the Create a new project page, enter console in the search box. Next, choose C# or Visual Basic from the language list, and then choose All platforms from the platform list. Choose the Console App template, and then choose Next.

    In the Configure your new project dialog, enter HelloWorld in the Project name box. Then choose Next.

    1. In the Additional information dialog:
    • Select .NET 8 (Preview).
    • Select Do not use top-level statements.
    • Select Create.

    Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.