【问题标题】:Using Nant to build and deploy asp.net, vb.net , framework 1.1使用Nant搭建部署asp.net、vb.net、framework 1.1
【发布时间】:2012-09-26 11:54:05
【问题描述】:

如何正确使用 Nant 构建和部署使用 asp.net、vb.net 和 .net framework 1.1 开发的 asp.net 项目?

我尝试了这个构建文件:

<?xml version="1.0" ?>
<project name="MyWebProj" default="build" basedir=".">
    <description>...</description>
    <property name="debug" value="true" overwrite="false"
    />
    <property name="basename" value="MyWebProj" />
    <target name="build">
        <mkdir dir="NantBIN" />
        <vbc target="library" output="NantBIN/${basename}.dll" debug="${debug}">
            <sources>
                <include name="*.vb" />
            </sources>
        </vbc>
    </target>
</project>

然后我运行这个 bat 文件:

@echo off bin\nant -t:net-1.1 -buildfile:.MyWebProjPath pause

【问题讨论】:

  • 我尝试使用这个构建文件: &lt;?xml version="1.0"?&gt; &lt;project name="MyWebProj" default="build" basedir="."&gt; &lt;description&gt;...&lt;/description&gt; &lt;property name="debug" value="true" overwrite="false" /&gt; &lt;property name="basename" value="MyWebProj"/&gt; &lt;target name="build"&gt; &lt;mkdir dir="NantBIN" /&gt; &lt;vbc target="library" output="NantBIN/${basename}.dll" debug="${debug}"&gt; &lt;sources&gt; &lt;include name="*.vb"/&gt; &lt;/sources&gt; &lt;/vbc&gt; &lt;/target&gt; &lt;/project&gt; 我运行这个 bat 文件: @echo off bin\nant -t:net-1.1 -buildfile:.MyWebProjPath pause
  • @gardenunez 欢迎来到 SO。您应该编辑您的问题以包含将来的后续信息,以便人们更容易找到相关信息,特别是值得结构化的数据,例如 XML。我已经为你添加了这个。希望对您有所帮助。
  • @Scott 感谢您的帮助和推荐。

标签: asp.net .net vb.net build nant


【解决方案1】:

【讨论】:

  • 在本文中,他们主要使用 MSBuild 命令。我想我不能在 .net framework 1.1 上使用它,或者有办法使用它?
【解决方案2】:

首先,感谢您的所有回答和建议。 这就是我最终解决问题的方法。我将其用作构建文件:

<?xml version="1.0"?><project name="..." default="rebuild" basedir=".">
<target name="rebuild" depends="build">
    <call target="build.copy"/>
</target>
<target name="build" description="Build all targets.">
    <call target="build.project"/>
</target>
<target name="build.project">
    <solution configuration="${configuration}" solutionfile="${solutionName}" outputdir="${expected.output}">
        <webmap>
            <map url="${webproj.url}" path="${webproj.name}" />
        </webmap>
    </solution>
</target>
<target name="build.copy">
    <copy  todir="${path.to.deploy}" overwrite="true">
        <fileset basedir=".">
            ...
            <include name="**\*.asp" />
            <include name="**\*.aspx" />
            <include name="**\*.css" />
            <include name="**\*.js" />
            ...
        </fileset>
    </copy>
</target>

我运行这个 bat 文件(设置 -t:net-1.1 以指定 .net 框架版本很重要):

bin\nant -t:net-1.1 -buildfile:.MyWebProjPath

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-05-31
    • 1970-01-01
    • 2011-11-30
    • 1970-01-01
    • 1970-01-01
    • 2016-10-25
    • 2010-10-05
    • 2016-10-14
    相关资源
    最近更新 更多