1

I looked on SO and google for a solution to this scaffolding struggle I'm having. No luck, so here's the Q:

I've used the (pretty great) articles Steve Anderson wrote about scaffolding to get the scaffolding for my project setup, but can't get one thing to work. http://blog.stevensanderson.com/2011/01/13/mvcscaffolding-standard-usage/

First I copied the CodeTemplates directory from VS 2013 into my project, like so: (I added arrows to the scaffolder I wish to use)

the MvcControllerWithContext also scaffolds the views

Then, when I scaffold from Visual Studio, I do Add -> Controller and select this scaffolding template:

selection

And it all works, the scaffolder uses the custom CodeTemplate I copied into my project. Good times. But now the thing I can't get to work. I'd like to use the powershell (package manager console) of VS to do the scaffolding, because I have to re-scaffold all the controllers (about 15) with all the views often.

So I tried this:

  Scaffold Controller -ControllerName MyController -DbContextType MyContext -Area MyArea -Force

But it uses the default controller set and not the one I edited in the CodeTemplates. Which scaffolders do I have anyway?

which scaffolders

Hmm, ok, so now I try to set the default scaffolder to my own Controller scaffolder in the CodeTemplates directory:

no dice

And woosh, them's the breakes. So that's where I am stuck. I can't get the 'Scaffold' command in the console to work with my custom scaffolder in CodeTemplates.

Does anyone have an idea? Thx in advance.

Community
  • 1
  • 1
Gerben Rampaart
  • 9,853
  • 3
  • 26
  • 32

1 Answers1

0

Please make sure you have the following version of MVC Scaffolding installed. https://www.nuget.org/packages/MvcScaffolding/1.0.8-vs2013

pranav rastogi
  • 4,124
  • 23
  • 23