Skip to content

Error: The requested service 'Cake.Commands.DefaultCommandSettings' has not been registered #3697

@augustoproiete

Description

@augustoproiete

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

Cake runner

Cake .NET Tool

Cake version

2.0.0-rc0001

Operating system

N/A

Operating system architecture

N/A

CI Server

N/A

What are you seeing?

When attempting to F5/Debug the Cake project on Visual Studio 2022 (also on 2019), we get the error below:


Autofac.Core.Registration.ComponentNotRegisteredException
  HResult=0x80131500
  Message=The requested service 'Cake.Commands.DefaultCommandSettings' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
  Source=Autofac
  StackTrace:
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Cake.Infrastructure.Composition.AutofacTypeResolver.Resolve(Type type) in C:\...\cake\src\Cake\Infrastructure\Composition\AutofacTypeResolver.cs:line 22
   at Spectre.Console.Cli.TypeResolverAdapter.Resolve(Type type) in /_/src/Spectre.Console/Cli/Internal/TypeResolverAdapter.cs:line 25

image

What is expected?

No exception thrown / Autofac should be able to resolve DefaultCommandSettings

Steps to Reproduce

  • Open the Cake solution
  • Debug the execution of an existing .cake file

Output log

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions