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

  • Home
  • SEARCH
  • 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 8855887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:14:12+00:00 2026-06-14T14:14:12+00:00

I want to create a Custom Scaffolder that uses arbitrary PowerShell logic. It can

  • 0

I want to create a Custom Scaffolder that uses arbitrary PowerShell logic. It can render T4 templates (multiple ones if I want), with the result being output:

  • As a new file in your project
  • as a new code block inserted into an existing class
  • my PowerShell logic can use Visual Studio’s “code model” API to manipulate files and code elements in other arbitrary ways.

How to Customize T4 Scaffolding With PowerShell?

  • 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-14T14:14:13+00:00Added an answer on June 14, 2026 at 2:14 pm

    From http://blog.stevensanderson.com/2011/04/07/mvcscaffolding-creating-custom-scaffolders/:

    In Package Manager Console of Visual Studio execute the following
    command :

    Scaffold CustomScaffolder ClassName
    

    This adds a CodeTemplates folder to your project, containing files for
    the new scaffolder.

    As you can see, we’ve got two files:

    • A PowerShell script (.ps1), where we can put arbitrary logic to decide what templates get rendered and where the output goes. By
      default, it renders a T4 template and uses the output to create a new
      file called ExampleOutput in the root of your project.
    • A T4 template (.t4), i.e., the thing that the default .ps1 file renders. By default this generates a simple C#/VB class (depending on
      your project type). If you want to see this working, you can run the
      custom scaffolder right away:

      Scaffold ClassName

    This will generate a new class file, ExampleOutput.cs, in the root
    folder of your project. That’s really just to show you how it works.
    We don’t really want that, so don’t run the new scaffolder yet, or if
    you already have done, delete ExampleOutput.cs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create custom labels using UILabel that look like the ones iPhone
I want to create custom events called user_logged so that i can attach my
I want to create custom search engine for multiple domain. How can I use
Inside my UserRepository I want to create custom queries, like the ones I can
i want create a custom json data from the mssql 2008 results so that
I want to create a custom set that will automatically convert objects into a
I want to create a custom style for an activity that will look like
I want to create a custom field on which I can place more than
I want to create custom WPF control that has a single child control inside.
I want to create custom control (let's name it DesignPanel ) that will allow

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.