visual-studio - 是否可以让 nant 在 Web 应用程序项目上运行发布

标签 visual-studio ftp nant publish nant-task

是否可以让 nant 在 mvc 项目或一个好的旧 Web 应用程序项目上运行发布
并在发布后使​​ nant FTP 文件到 Web 服务器

更新:找到了解决ftp问题的方法
Nant ftp task谢谢帕科

我说的publich是什么意思
是否有命令行应用程序或 nant 任务可以像 Visual Studio 一样公开发布...

最佳答案

Visual Studio 发布命令重建您的解决方案,然后将解决方案目录中的文件复制到新目录。我使用以下目标来做几乎相同的事情:

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

在此目标之前,您当然必须运行正常的构建过程。

关于visual-studio - 是否可以让 nant 在 Web 应用程序项目上运行发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/430904/

相关文章:

c# - 自动从Visual Studio授予UWP应用程序权限

ftp - Apache Camel FTP - 如何手动启动路由

php - 如何重定向 https ://to https://www on . htaccess 文件?

msbuild - CruiseControl.Net Web 仪表板不显示结果

xml - VS2010 有 xml 模式验证器吗?

vb.net - 是否可以在设计时在富文本框中设置文本样式?

c++ - 当主函数没有 “return 0”语句时,在Visual Studio中没有警告

python - urllib.urlretrieve 的代理设置

tfs - 使用 nant 从 TFS 获取代码

editor - 有哪些 NAnt 编辑器可用?