views:

1510

answers:

2

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...

+3  A: 

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.

Paco
+5  A: 

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.

Paco
This only copies the DLLs and not webpages
Khash
This does copy the .aspx, .ascx, .html, etc "webpages".
Paco