Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9304239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:39:55+00:00 2026-06-18T23:39:55+00:00

When I generate my controller and views with the below command scaffold controller <Entity>

  • 0

When I generate my controller and views with the below command

scaffold controller <Entity> -force -repository -DbContextType "XXX" -Area YYY

It generates .aspx (web form) pages instead of .cshtml (razor)

How can I change this default behaviour. I think when I first created a new project it asked me to select the default view engine and I picked the wrong one (webforms).

Also are there any free or cheap T4 templates for MVC 3 that generate nicer and more functional views. i.e using webgrid / jQUery etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:39:56+00:00Added an answer on June 18, 2026 at 11:39 pm

    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" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Running the command generates new rails projects: $ rails generate controller home index The
ASP.NET MVC 3 can generate scaffold code for us(controllers and views). The generated views
If I generate new model, view and controller with rails scaffold generator I get
rails generate scaffold controller sportler name:string rails generate model einheit ... sportler_id:integer /app/controllers/sportlers_controller.rb ..
I need generate action links outside controllers. I can use Html.Action in Views, Url.Action
I have this in my controller. I need my view to generate some HTML,
I did rails generate controller home index But it adds this line to my
I am trying to generate a controller with all the RESTful actions stubbed. I
When I create a new controller in Visual Studio with MVC It generate automatically
I need to test a controller, of action index (generated by the grails generate-all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.