dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.72k stars 1.07k forks source link

dotnet new not working #8515

Closed fanoI closed 4 years ago

fanoI commented 7 years ago

Steps to reproduce

  1. Create a new directory
  2. Go to it with command prompt
  3. Launch "dotnet new"

Expected behavior

A C# "hello world" program is generated

Actual behavior

Errors during nuget cache population (?)

C:\Users\fano\Documenti\test_dotnet_new>dotnet new

Welcome to .NET Core!
---------------------
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Use dotnet --help to see available commands or go to https://aka.ms/dotnet-cli-docs.

Telemetry
--------------
The .NET Core tools collect usage data in order to improve your experience. The data is anonymous and does not include command-line arguments. The data is collected by Microsoft and shared with the community.
You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.
You can read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.

Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.

Unhandled Exception: System.Exception: input .lzma is too short
   at Microsoft.DotNet.Archive.CompressionUtility.Decompress(Stream inStream, Stream outStream, IProgress`1 progress)
   at Microsoft.DotNet.Archive.IndexedArchive.Extract(String compressedArchivePath, String outputDirectory, IProgress`1 progress)
   at Microsoft.DotNet.Configurer.NuGetPackagesArchiver.ExtractArchive()
   at Microsoft.DotNet.Configurer.NuGetCachePrimer.PrimeCache()
   at Microsoft.DotNet.Configurer.DotnetFirstTimeUseConfigurer.Configure()
   at Microsoft.DotNet.Cli.Program.ConfigureDotNetForFirstTimeUse(INuGetCacheSentinel nugetCacheSentinel)
   at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

Environment data

.NET Command Line Tools (1.0.4)

Product Information: Version: 1.0.4 Commit SHA-1 hash: af1e6684fd

Runtime Environment: OS Name: Windows OS Version: 10.0.15063 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.4

I have used dotnet before without problems so you this "welcome" as if I never used it?

livarcocc commented 7 years ago

It seems like the lzma archive is corrupted in your installation. How did you install this? did you use this same version before?

We write a sentinel file under your NuGet cache to indicate if the cache has been populated. If you delete your NuGet cache folder, the first run experience will run again.

fanoI commented 7 years ago

Thank you for your support!

The strange thing is that I had Visual Studio opened from Sunday in which all worked and it remained opened in the tray bar for all week pratically, yesterday wanted to test something and got this error! If it not auto-updated by Windows 10 yes I used the same version on Net Core.

How could I restore this lzma archive?

livarcocc commented 7 years ago

can you try uninstalling the 1.0.4 CLI from appwiz.cpl and then installing again using the msi? And seeing if that solves your problem?

fanoI commented 7 years ago

It seems doing "repair" was sufficient! Strange things can corrupts themselves so suddenly...

Ryan-ED commented 7 years ago

Do I need to specify a template in the command? When I type dotnet new it gives me a list of argument options. I'm a total noob so please use English. Thanks!

C:\Users\me\Documents\Projects\newProj>dotnet new
Template Instantiation Commands for .NET Core CLI.

Usage: dotnet new [arguments] [options]

Arguments:
  template  The template to instantiate.

Options:
  -l|--list         List templates containing the specified name.
  -lang|--language  Specifies the language of the template to create
  -n|--name         The name for the output being created. If no name is specified, the name of the current directory is used.
  -o|--output       Location to place the generated output.
  -h|--help         Displays help for this command.
  -all|--show-all   Shows all templates

Templates                 Short Name      Language      Tags
----------------------------------------------------------------------
Console Application       console         [C#], F#      Common/Console
Class library             classlib        [C#], F#      Common/Library
Unit Test Project         mstest          [C#], F#      Test/MSTest
xUnit Test Project        xunit           [C#], F#      Test/xUnit
ASP.NET Core Empty        web             [C#]          Web/Empty
ASP.NET Core Web App      mvc             [C#], F#      Web/MVC
ASP.NET Core Web API      webapi          [C#]          Web/WebAPI
Solution File             sln                           Solution

Examples:
    dotnet new mvc --auth None --framework netcoreapp1.1
    dotnet new mstest --framework netcoreapp1.1
    dotnet new --help
fanoI commented 7 years ago

Yes 'dotnet new console' creates the classical C# "hello world" for example.

RZProf commented 6 years ago

I have an error Failed to load �P�U, error: /usr/lib/libm.so.6: versionGLIBC_2.27' not found (required by /opt/dotnet/shared/Microsoft.NETCore.App/2.1.1/libcoreclr.so) Failed to bind to CoreCLR at '/opt/dotnet/shared/Microsoft.NETCore.App/2.1.1/libcoreclr.so' i dont know what is it!!!