CodeSmith Community
Your Code. Your Way. Faster!

Include non-generated files in output

Latest post 09-19-2007 8:17 AM by pwelter34. 1 replies.
  • 09-13-2007 12:46 PM

    • rcmacdon
    • Not Ranked
    • Joined on 07-15-2007
    • Waterloo, Ontario
    • Posts 1
    • Points 35

    Include non-generated files in output

    I am trying to build an asp.net project automatically and want to have images in the project by default.  How do I configure the template to create a folder and copy some existing files into it.  These files could be any format or type.

    VB examples would be appreciated, but I can figure out the C#

    _______________________________ Clint MacDonald, BASc http://www.interglobal.ca
    • Post Points: 35
  • 09-19-2007 8:17 AM In reply to

    • pwelter34
    • Top 25 Contributor
    • Joined on 03-13-2003
    • Eden Prairie, MN
    • Posts 255
    • Points 749,915

    Re: Include non-generated files in output

    Hi,

    You can use .net code in your template.  Here is an example ...

    <%@ CodeTemplate Language="VB" TargetLanguage="VB" Description="" %>
    <%@ Property Name="OutputDirectory" Type="System.String"
        Default="" Category="Options" %>

    <%@ Import Namespace="System.IO" %>
    <script runat="template">
    Function CopyProject() As String
        'do copy here
        File.Copy("source\image.gif", Path.Combine(OutputDirectory, "image.gif"))
    End Function
    </script>

    <% CopyProject %>

     

    ~ Paul 


     

    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems