RickAndMSFT
RickAndMSFT

Reputation: 22810

There was an error running the selected code generator: `No parameterless constructor defined for this object at

When trying to add a controller using Visual Studio , you may get the following error:

There was an error running the selected code generator: `No parameterless constructor defined for this object at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.b__6_0()

Upvotes: 2

Views: 1200

Answers (1)

RickAndMSFT
RickAndMSFT

Reputation: 22810

One reason is a bad package in the local nuget cache. Clearing out the local nuget cache solves this problem.

For more info, see this issue.

If that doesn't work, try the following:

dotnet tool uninstall -g dotnet-aspnet-codegenerator
dotnet tool install -g dotnet-aspnet-codegenerator 

Upvotes: 4

Related Questions