I'm using the MvcScaffolding NuGet Package to scaffold a couple of Controllers. I'm currently repeating the same process ie. Scaffold Controller MyController -Repository -Force
. I do this for a number of controllers. Is there a way to run a script on the console where I can put a couple of commands and run them once?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I'm a Powershell noob, so there may be a better way, but I just ran this in the Package Manager Console:
$controllers = "test", "test2"; foreach ($controller in $controllers) { echo $controller }
And it seemed to work, so maybe something like this would work?
$controllers = "test", "test2"; foreach ($controller in $controllers) { Scaffold Controller $controller -Repository -Force }