Solution wide scaffolders configuration is stored in scaffolding.config
which is located in the same folder with solution file.
On installation stage MvcScaffolding
package launches init.ps
script (you can find it in <packages folder>\MvcScaffolding.<version>\tools
directory). Script counts aspx
, cshtml
and vbhtml
views and based on these numbers decideds what view scaffolder will be used. Here is a piece of this logic:
function InferPreferredViewEngine() {
# Assume you want Razor except if you already have some ASPX views and no Razor ones
if ((CountSolutionFilesByExtension aspx) -eq 0) { return "razor" }
if (((CountSolutionFilesByExtension cshtml) -gt 0) -or ((CountSolutionFilesByExtension vbhtml) -gt 0)) { return "razor" }
return "aspx"
}
# Infer which view engine you're using based on the files in your project
$viewScaffolder = if ([string](InferPreferredViewEngine) -eq 'aspx') { "MvcScaffolding.AspxView" } else { "MvcScaffolding.RazorView" }
Set-DefaultScaffolder -Name View -Scaffolder $viewScaffolder -SolutionWide -DoNotOverwriteExistingSetting
So you can switch view scaffolder using following commands:
Set-DefaultScaffolder -Name View -Scaffolder "MvcScaffolding.RazorView" -SolutionWide
Set-DefaultScaffolder -Name View -Scaffolder "MvcScaffolding.AspxView" -SolutionWide
Or you can manually edit scaffolding.config
file and replace value for ScaffolderName
attribute in tag:
<Default DefaultName="View" ScaffolderName="put here either MvcScaffolding.RazorView or MvcScaffolding.AspxView" />