LPT Template w/o Generating File

Posts   
 
    
dtkujawski avatar
dtkujawski
User
Posts: 39
Joined: 05-Jul-2007
# Posted on: 25-Mar-2008 20:04:21   

Can I set a LPT Template to be executed without generating any output files?

I have a "post generation" template that I created where it performs some basic cleanup steps.

Here is my task:

    <taskGroupPreset name="SD.Tasks.Base.GenericTaskGroup" displayName="Post Generation" additionalDestinationFolder="Common\Service Interface\uFACTS.DataContracts">
      <taskPreset name="SD.Tasks.Base.ConsumeLptTemplate">
        <parameters>
          <parameter name="destinationFolder" value="" />
          <parameter name="templateID" value="uFACTS_PostGeneration_CleanComments" />
          <parameter name="emitType" value="generic" />
          <parameter name="filenameFormat" value="debug.[extension]" />
        </parameters>
      </taskPreset>
    </taskGroupPreset>

When this is run, it creates a bunch of DEBUG.CS files that are then added to the project. I could move this task to be AFTER the project task, but I was wondering if there was another way to do this using a parameter?

Thanks in advance

dtkujawski avatar
dtkujawski
User
Posts: 39
Joined: 05-Jul-2007
# Posted on: 25-Mar-2008 20:19:52   

I thought of ONE solution which would be to add a DUMMY VSProject taskgroup after the LPT template. Since this projcet isn't part of the Solution file, it is just sitting out there:

    <taskGroupPreset name="SD.Tasks.Base.GenericTaskGroup" displayName="Project File" additionalDestinationFolder="" additionalRootNamespace="Dummy">
      <taskPreset name="SD.Tasks.SelfServicing.VsNetProjectFileCreator">
        <parameters>
          <parameter name="templateID" value="SD_VsNet2005Template" />
          <parameter name="clearFileCacheAfterwards" value="true" />
        </parameters>
      </taskPreset>
    </taskGroupPreset>

Of course, this is crude and only works at the END of the preset... Anybody have any better ideas?

PS> The reson I can't simply end the preset with the LPT Template is because I have multiple presets that I use to generate the different projects within my solution. I have a batch program I run which combines these PRESET files together to make one LARGE preset (which is what I run most of the time). However, since I have the individual presets also - I can run those individually... So... If I just put the LPT task at the end of each individual preset; it would just add that DEBUG.CS file to the NEXT project file in the preset.

-Dave

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 25-Mar-2008 20:57:58   

You could as well, create your own Task Performer, Is very straightforward. Download the sources to see how they work. Let us know how it went.

dtkujawski avatar
dtkujawski
User
Posts: 39
Joined: 05-Jul-2007
# Posted on: 26-Mar-2008 13:25:57   

Excellent idea... I'll look at doing that when I get some time over the next few days...

Thanks!

dtkujawski avatar
dtkujawski
User
Posts: 39
Joined: 05-Jul-2007
# Posted on: 02-Apr-2008 17:02:58   

As I started thinking about your suggestion, I found a very simple solution.

In my LPT script, if I do the following at the end of my processing - it will remove the file and not add it to the VS Project:

throw new TemplateAbortException();

Since this exception is not bubbled up to the rest of the generating code - it has the effect of achieving exactly what I was looking for, without having to diverge from the standard LPTParser code base with another custom parser...

Thanks for putting me down the path...