Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't create a project with dotnet cli #22846

Open
timelessnesses opened this issue Dec 1, 2021 · 3 comments
Open

I can't create a project with dotnet cli #22846

timelessnesses opened this issue Dec 1, 2021 · 3 comments
Assignees
Labels
Area-CLI untriaged Request triage from a team member

Comments

@timelessnesses
Copy link

Describe the bug

The bug is spit out error when I tried to create project or list all templates

To Reproduce

dotnet new console

or

dotnet new --list

Exceptions (if any)

D:\test_c#>dotnet new --list
Missing or invalid manifest version
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadManifestReader.ReadWorkloadManifest(String id, String informationalPath, LocalizationCatalog localizationCatalog, Utf8JsonStreamReader& reader)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadManifestReader.ReadWorkloadManifest(String manifestId, Stream manifestStream, Stream localizationStream, String informationalPath)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.LoadManifestsFromProvider(IWorkloadManifestProvider manifestProvider)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.Create(IWorkloadManifestProvider manifestProvider, String dotnetRootPath, String sdkVersion, String userProfileDir)
   at Microsoft.DotNet.TemplateLocator.TemplateLocator.GetDotnetSdkTemplatePackages(String sdkVersion, String dotnetRootPath, String userProfileDir)
   at Microsoft.DotNet.Tools.New.OptionalWorkloadProvider.GetAllTemplatePackagesAsync(CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.<>c__DisplayClass21_0.<EnsureProvidersLoaded>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__271_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.GetTemplatePackagesAsync(Boolean force, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.UpdateTemplateCacheAsync(Boolean needsRebuild, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.GetTemplatesAsync(CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.TemplateResolution.BaseTemplateResolver.GetTemplateGroupsAsync(CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.TemplateResolution.ListTemplateResolver.ResolveTemplatesAsync(INewCommandInput commandInput, String defaultLanguage, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.HelpAndUsage.TemplateInformationCoordinator.DisplayTemplateGroupListAsync(INewCommandInput commandInput, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.New3Command.EnterMaintenanceFlowAsync(INewCommandInput commandInput)
   at Microsoft.TemplateEngine.Cli.New3Command.ExecuteAsync(INewCommandInput commandInput)
   at Microsoft.TemplateEngine.Cli.New3Command.ActualRun(String commandName, ITemplateEngineHost host, ITelemetryLogger telemetryLogger, New3Callbacks callbacks, String[] args, String hivePath)
D:\test_c#>dotnet new console
Missing or invalid manifest version
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadManifestReader.ReadWorkloadManifest(String id, String informationalPath, LocalizationCatalog localizationCatalog, Utf8JsonStreamReader& reader)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadManifestReader.ReadWorkloadManifest(String manifestId, Stream manifestStream, Stream localizationStream, String informationalPath)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.LoadManifestsFromProvider(IWorkloadManifestProvider manifestProvider)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.Create(IWorkloadManifestProvider manifestProvider, String dotnetRootPath, String sdkVersion, String userProfileDir)
   at Microsoft.DotNet.TemplateLocator.TemplateLocator.GetDotnetSdkTemplatePackages(String sdkVersion, String dotnetRootPath, String userProfileDir)
   at Microsoft.DotNet.Tools.New.OptionalWorkloadProvider.GetAllTemplatePackagesAsync(CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.<>c__DisplayClass21_0.<EnsureProvidersLoaded>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__271_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.GetTemplatePackagesAsync(Boolean force, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.UpdateTemplateCacheAsync(Boolean needsRebuild, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Edge.Settings.TemplatePackageManager.GetTemplatesAsync(CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.TemplateResolution.BaseTemplateResolver.GetTemplateGroupsAsync(CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.TemplateResolution.InstantiateTemplateResolver.ResolveTemplatesAsync(INewCommandInput commandInput, String defaultLanguage, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.TemplateInvocationCoordinator.CoordinateInvocationAsync(INewCommandInput commandInput, CancellationToken cancellationToken)
   at Microsoft.TemplateEngine.Cli.New3Command.EnterTemplateManipulationFlowAsync(INewCommandInput commandInput)
   at Microsoft.TemplateEngine.Cli.New3Command.ExecuteAsync(INewCommandInput commandInput)
   at Microsoft.TemplateEngine.Cli.New3Command.ActualRun(String commandName, ITemplateEngineHost host, ITelemetryLogger telemetryLogger, New3Callbacks callbacks, String[] args, String hivePath)

Further technical details

  • Include the output of dotnet --info
.NET SDK (reflecting any global.json):
 Version:   6.0.100
 Commit:    9e8b04bbff

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

Host (useful for support):
  Version: 6.0.0
  Commit:  4822e3c3aa

.NET SDKs installed:
  6.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.21 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
  • The IDE (VS / VS Code/ VS4Mac) you're running on, and its version
C:\Users\moopi>code --version
1.60.2
7f6ab5485bbc008386c4386d08766667e155244e
x64
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-CLI untriaged Request triage from a team member labels Dec 1, 2021
@ponlawat-w
Copy link

Hi, I had the same issue and got fixed by remove all the contents inside C:\Program Files\dotnet\sdk-manifests\6.0.100 (or move them to a different folder), then my dotnet CLI became working again. (But I think there should be a better solution.)

@timelessnesses
Copy link
Author

Hi, I had the same issue and got fixed by remove all the contents inside C:\Program Files\dotnet\sdk-manifests\6.0.100 (or move them to a different folder), then my dotnet CLI became working again. (But I think there should be a better solution.)

it fixed.

nice

@ponlawat-w
Copy link

This seems to be caused from the same reason I faced in the issue #23004.
The method String.IndexOf also returns a different result when user's locale is not en-US (which in my case it is Thai).

I have added the argument comparisonType with value System.StringComparison.InvariantCulture to all String.IndexOf calling in the FXVersion.TryParse method in FXVersion.cs.
After rebuilding the SDK, the command dotnet new --list is now working again without removing sdk-manifests folder as previously suggested above.

public static bool TryParse(string fxVersionString, out FXVersion FXVersion)
{
    ...
    int majorSeparator = fxVersionString.IndexOf(".", System.StringComparison.InvariantCulture);
    ...
    int minorSeparator = fxVersionString.IndexOf(".", minorStart, System.StringComparison.InvariantCulture);
    ...
    int preSeparator = fxVersionString.IndexOf("+", preStart, System.StringComparison.InvariantCulture);
    ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CLI untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

3 participants