Creating multiple files in solution folder using T4 template











up vote
0
down vote

favorite












I am trying to create multiple files in an existing project within the Solution Folder using T4 template, based on tangible T4 template. I followed the steps in the document but can't generate the multiple files with the structure below. There were no errors occurred during the process, so I am expecting that it will generate the files. I've included the codes here, please see below.



enter image description here



MultipleOutputFiles.tt



<#@ template language="C#" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ include file="TemplateFileManagerV2.1.ttinclude" #>
<#

var manager = TemplateFileManager.Create(this);

#>

// this output code will be written to MultipleOutputFiles.cs

<#
var fileProperties=new FileProperties();

manager.StartNewFile("Outputfile9.txt","SomeOtherProject","SubFolder", fileProperties);

#>

// this output code will be written to Outputfile2.txt
<#

manager.Process();

#>


for TemplateFileManagerV2.1.ttinclude.tt complete code, you can get from this link TemplateFileManagerV2.1.ttinclude.tt. Take note that there is an error using the .First() since there is no value in the collection yet, I changed it to .FirstOrDefault().










share|improve this question




























    up vote
    0
    down vote

    favorite












    I am trying to create multiple files in an existing project within the Solution Folder using T4 template, based on tangible T4 template. I followed the steps in the document but can't generate the multiple files with the structure below. There were no errors occurred during the process, so I am expecting that it will generate the files. I've included the codes here, please see below.



    enter image description here



    MultipleOutputFiles.tt



    <#@ template language="C#" hostSpecific="true" #>
    <#@ output extension=".cs" #>
    <#@ include file="TemplateFileManagerV2.1.ttinclude" #>
    <#

    var manager = TemplateFileManager.Create(this);

    #>

    // this output code will be written to MultipleOutputFiles.cs

    <#
    var fileProperties=new FileProperties();

    manager.StartNewFile("Outputfile9.txt","SomeOtherProject","SubFolder", fileProperties);

    #>

    // this output code will be written to Outputfile2.txt
    <#

    manager.Process();

    #>


    for TemplateFileManagerV2.1.ttinclude.tt complete code, you can get from this link TemplateFileManagerV2.1.ttinclude.tt. Take note that there is an error using the .First() since there is no value in the collection yet, I changed it to .FirstOrDefault().










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am trying to create multiple files in an existing project within the Solution Folder using T4 template, based on tangible T4 template. I followed the steps in the document but can't generate the multiple files with the structure below. There were no errors occurred during the process, so I am expecting that it will generate the files. I've included the codes here, please see below.



      enter image description here



      MultipleOutputFiles.tt



      <#@ template language="C#" hostSpecific="true" #>
      <#@ output extension=".cs" #>
      <#@ include file="TemplateFileManagerV2.1.ttinclude" #>
      <#

      var manager = TemplateFileManager.Create(this);

      #>

      // this output code will be written to MultipleOutputFiles.cs

      <#
      var fileProperties=new FileProperties();

      manager.StartNewFile("Outputfile9.txt","SomeOtherProject","SubFolder", fileProperties);

      #>

      // this output code will be written to Outputfile2.txt
      <#

      manager.Process();

      #>


      for TemplateFileManagerV2.1.ttinclude.tt complete code, you can get from this link TemplateFileManagerV2.1.ttinclude.tt. Take note that there is an error using the .First() since there is no value in the collection yet, I changed it to .FirstOrDefault().










      share|improve this question















      I am trying to create multiple files in an existing project within the Solution Folder using T4 template, based on tangible T4 template. I followed the steps in the document but can't generate the multiple files with the structure below. There were no errors occurred during the process, so I am expecting that it will generate the files. I've included the codes here, please see below.



      enter image description here



      MultipleOutputFiles.tt



      <#@ template language="C#" hostSpecific="true" #>
      <#@ output extension=".cs" #>
      <#@ include file="TemplateFileManagerV2.1.ttinclude" #>
      <#

      var manager = TemplateFileManager.Create(this);

      #>

      // this output code will be written to MultipleOutputFiles.cs

      <#
      var fileProperties=new FileProperties();

      manager.StartNewFile("Outputfile9.txt","SomeOtherProject","SubFolder", fileProperties);

      #>

      // this output code will be written to Outputfile2.txt
      <#

      manager.Process();

      #>


      for TemplateFileManagerV2.1.ttinclude.tt complete code, you can get from this link TemplateFileManagerV2.1.ttinclude.tt. Take note that there is an error using the .First() since there is no value in the collection yet, I changed it to .FirstOrDefault().







      c# visual-studio visual-studio-2017 t4 tangible-t4-editor






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 23:29

























      asked Nov 9 at 15:15









      cris gomez

      3910




      3910





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228430%2fcreating-multiple-files-in-solution-folder-using-t4-template%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228430%2fcreating-multiple-files-in-solution-folder-using-t4-template%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Guess what letter conforming each word

          Port of Spain

          Run scheduled task as local user group (not BUILTIN)