is it possible to make nant run a publish on web application project
Asked Answered
P

2

8

is it possible to make nant run a publish on mvc project or a good old web application project
and after the publish make nant FTP the files to the web server

UPDATE: found the solution to the ftp problem
Nant ftp task thanks Paco

what i mean by publich
is there a command line application or nant task that can public like visual studio publish...

Prudish answered 10/1, 2009 at 12:26 Comment(0)
C
8

The visual studio publish command rebuilds your solution and then copies the files in the solution directory to a new directory. I use the following target to do almost the same:

<target name="copyToPublish">
    <delete dir="${dir.publish}" />
    <mkdir dir="${dir.publish}" />
    <mkdir dir="${dir.publish}\wwwroot"/>
    <copy todir="${dir.publish}\wwwroot" includeemptydirs="false">
      <fileset basedir="${website.dir}">
        <exclude name="**/*.cs"/>
        <exclude name="**/*.pdb"/>
        <exclude name="**/*.csproj*"/>
        <exclude name="**/obj/**"/>
        <include name="**/*.*"/>
      </fileset>
    </copy>
    <mkdir dir="${dir.publish}\database"/>
    <copy todir="${dir.publish}\database" includeemptydirs="false">
      <fileset basedir="${dir.databasescripts}">
        <include name="**/*.sql" />
      </fileset>
    </copy>
    <xmlpoke
            file="${dir.publish}\wwwroot\Web.config"
            xpath="/configuration/system.web/compilation/@debug"
            value="false" />
    <xmlpoke
            file="${dir.publish}\wwwroot\Web.config"
            xpath="/configuration/system.web/trace/@enabled"
            value="false" />
    <move file="${dir.publish}\wwwroot\Web.config" tofile="${dir.publish}\wwwroot\Release.config" overwrite="true" />
    <delete file="${dir.publish}\wwwroot\Web.config" />
</target>

Before this target you have to run the normal build procedure of course.

Croix answered 10/1, 2009 at 15:55 Comment(2)
This only copies the DLLs and not webpagesHyperostosis
This does copy the .aspx, .ascx, .html, etc "webpages".Croix
C
3

There is a Ftp Task for nant. Beside that, you have to create a script that copies the files and directories you need and the config files. I don't do it automatically, because I want to have control over database update scripts and changes in web.config.

Croix answered 10/1, 2009 at 12:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.