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 8372713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:30:23+00:00 2026-06-09T14:30:23+00:00

I am using Visual Studio 2010 TextTemplatingFileGenerator custom tool to generate C# code (.cs)

  • 0

I am using Visual Studio 2010 TextTemplatingFileGenerator custom tool to generate C# code (.cs) and would like to know if is there a way of preventing a given .tt from being completely generated upon a given programmatic condition.

I want to achieve the following:

  • Sometimes I want to generate a regular editable class;
  • Other times I want to generate a pair of classes to represent a parent-child relation, each of them implementing their specific set of rules required by their role.

Before answering, please bear in mind that DO NOT intend to use TextTemplatingFilePreprocessor – I already have explored its strengths and weaknesses. Although is suitable for other scenarios, is not for my current context. So I really want to stick to TextTemplatingFileGenerator.

  • 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-09T14:30:25+00:00Added an answer on June 9, 2026 at 2:30 pm

    If you can live with a minimal stub file being generated for all of A, B, C (or alternatively one ‘control’ file that always generates a minimal stub) then you can do this directly with T4 using something like Damien Guard’s multiple file output technique.

    http://damieng.com/blog/2009/11/06/multiple-outputs-from-t4-made-easy-revisited

    This can be controlled programmatically from your template.

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

Sidebar

Related Questions

Using Visual Studio 2010, I would like to switch over to using InstallShield LE
I am using Visual Studio 2010 Professional. Is there a way for me to
Using Visual Studio 2010, is there a way to run all unit tests in
Using Visual Studio 2010 I would like to do a project level regular expression
Using Visual Basic (and .NET 4) in Visual Studio 2010, I would like to
I'm using Visual Studio 2010 RC. Would it be possible that after doing my
I am using Visual Studio 2010 Professional. Suddenly the tool box controls are disappeared
I'm using Visual Studio 2010. When I change the code in my source file,
I'm using Visual Studio 2010 and AnkhSvn. There's a panel called PendingChanges (it's main
Using Visual Studio 2010 .Net Framework 4 C# Linq to Entities Issue I would

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.