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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:52:47+00:00 2026-06-07T00:52:47+00:00

I am working with a set of T4 script that generate partial classes for

  • 0

I am working with a set of T4 script that generate partial classes for my entities in a EF application.

Because partial classes need to reside in the same assembly, the script resides in the same project as the entity classes. It also needs access to the compiled assembly when executing.

When an error occured, the script will fail with the output “ErrorGeneratingOutput”. This will cause the whole project to NOT compile, because the generated file is an .cs file, with (at that point of time) invalid content.

So thats a vicious dependency circle, which can only be broken if I manually remove the error message from the generated file, and then trigger the build.

If there was a way to suppress the error message (or replace it by an empty string), my life would be much easier.

So the question is: can i change the error handling of a t4 script?

  • 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-07T00:52:48+00:00Added an answer on June 7, 2026 at 12:52 am

    In some cases, this problem can be solved easily.

    In my case, the problem was about loading the DLL of the project the T4 script resides in. The assembly directive was placed in the top region of the script (line 5). So i changed the output extension to txt.

    <#@ template language="C#" hostspecific="True" debug="True" #>
    <#@ output extension="txt" #>
    <#@assembly name="invalidAssemblyName"#>
    

    Then I placed the real output into another file using the EntityFrameworkFileManager.

    <#@ include file="EF.Utility.CS.ttinclude"#>
    <#
    var fileManager = EntityFrameworkTemplateFileManager.Create(this);
    fileManager.StartHeader();
    fileManager.StartNewFile("Output.cs");
    #>
    //content
    <#
    fileManager.Process();
    #>
    

    When the error occured, that an assembly cannot be loaded, the ErrorGeneratingOutput message is printed to the default .txt file, where it does not produce a problem for the compilation. If the assembly can be loaded, the output is printed to the Output.cs file.

    This way the project can be build after repairing the initial problem, and the developer doesnt have to take care about the ErrorGeneratingOutput problem, too.

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

Sidebar

Related Questions

I have a working perl script that grabs the data I need and displays
I need to code a PHP script that would let me generate a pdf
I am using an upload script that is working great: ini_set('memory_limit', '256M'); function uploadImage($files_name,
I'm working on a Perl script where the user adds a number of set
Working in bash under Linux ubuntu 10 here I have Bash script that reads
I am working on a script that creates several fairly complex nested hash datastructures
Were currently working on a script that reads the current users information from out
I need to make a large set of tests in telnet. I am working
I am working on a script that needs to run a perl script via
I am writing a marquee script because I do not like the fact that

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.