Forum:  Custom Templates

Thread:  How to get generated files added to csproj


yowl (User)   Posted on: 13-Dec-2016 17:54:39.
Hi,

Using LLBLGen 5, self servicing, I have created a preset and lpt template with a binding to generate a partial class per entity. On code generation the files are created correctly, but what is the trick to have the code generation update the csproj file so that they are included? At present I go to VS, "Show all Files" and include them manually which doesn't seem right.

Preset is a copy of the standard with this at the end:
Code:
    <taskPreset name="SD.Tasks.Base.ConsumeLptTemplate" displayName="JSON Ctor" >
    <parameters>
        <parameter name="destinationFolder" value="JsonCtors"/>
        <parameter name="filenameFormat" value="[elementName].[extension]"/>
        <parameter name="templateID" value="HSE_JSON"/>
        <parameter name="emitType" value="allEntities"/>
        <parameter name="failWhenExistent" value="false"/>
        <parameter name="templateBindingDefinitionName" value=""/>
        <parameter name="compileOnly" value="false"/>
        <parameter name="debugBuild" value ="false"/>
        <parameter name="templateIsOptional" value="false"/>
        <parameter name="templateAssemblySourceFileFormat" value="templatesSource.[extension]" />
        <parameter name="elementFilter" value=""/>
        <parameter name="dependentUponFilenameFormat" value=""/>
    </parameters>
</taskPreset>
</taskPresets>
</preset>
Walaa (Support Team)   Posted on: 14-Dec-2016 03:31:35.
The TaskPreset should be in the same TaskGroup which has other Code File Generation Tasks.
And make Sure the Project File Generator task is the last one in the TaskGroup, as each File Generator task inserts the generated filename in a cache, which is then picked up by the Project File Generator.


yowl (User)   Posted on: 14-Dec-2016 13:44:45.
Thanks, that was it.