build - 使用 NAnt 发布 Web 应用程序

标签 build nant publish

是否可以使用 NAnt 在解决方案上完成发布(如 Visual Studio 在 Web 应用程序项目上发布)?我只是找不到解决方案。

最佳答案

他们的关键是使用内置的“_CopyWebApplication”目标。

这是我所做的

<target name="compile" description="Compiles the project.">
        <exec basedir="." program="${DotNetPath}msbuild.exe" commandline=" src/MyProject.Web/MyProject.Web.csproj /nologo 
  /t:Rebuild
  /t:ResolveReferences;_CopyWebApplication
  /p:OutDir=../../output/build/bin/
  /p:WebProjectOutputDir=../../output/build/
  /p:Debug=${debug}
  /p:Configuration=${configuration}
  /v:m"
    workingdir="." failonerror="true" />
    </target>

目录结构为:
/project.build
/src/myprojct.sln
/src/myporject.web/myproject.web.csproj
/output

编辑:我也用它来使用 YUI 压缩来压缩我的 css 和 js
<target name="compress-js">
        <foreach item="File" property="filename">
            <in>
                <items basedir="output/build/assets/javascript/">
                    <include name="/**/*.js" />
                    <exclude name="/**/*.min.js" />
                    <exclude name="/**/*.pack.js" />
                </items>
            </in>
            <do>
                <exec basedir="." program="${JavaPath}java" commandline=" -jar S:\yuicompressor-2.4.1\build\yuicompressor-2.4.1.jar --type js --charset utf-8 -o &quot;${filename}&quot; &quot;${filename}&quot;" failonerror="true" />
            </do>
        </foreach>
    </target>


    <target name="compress-css" depends="combine-css">
        <foreach item="File" property="filename">
            <in>
                <items basedir="output/build/assets/css/">
                    <include name="/**/*.css" />
                    <exclude name="/**/*.min.css" />
                    <exclude name="/**/*.pack.css" />
                </items>
            </in>
            <do>
                <exec basedir="." program="S:\Java\jdk1.6.0_11\bin\java" commandline=" -jar S:\yuicompressor-2.4.1\build\yuicompressor-2.4.1.jar --type css --charset utf-8 -o &quot;${filename}&quot; &quot;${filename}&quot;" failonerror="true" />
            </do>
        </foreach>
    </target>

关于build - 使用 NAnt 发布 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/700871/

相关文章:

java - 使用 ANT ,如何在 scriptdef 中创建模式集?

ide - Nant 构建脚本 IDE

.net - 安装 ASP.NET 2.0 SDK 后,NAnt 在 Windows Server 2008 上构建失败

msbuild - 使用MSBuild或NAnt相对于从命令行运行DevEnv.exe的优势

Java Jar 版本命名约定

c# - 从 VS 2012 Express for Web 发布 C# 控制台应用程序。

ios - Xcode 8.0 架构 arm64 的 undefined symbol

java - 如何向 Gradle 添加新的源集?

c# - ClickOnce 发布期间出错

ant - Apache Ant : Selecting files with fileset?