使用Nant构建和部署asp.net,vb.net,框架1.1

时间:2012-10-05 10:28:42

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

如何正确使用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

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

首先,感谢您提供的所有答案和建议。 这就是我最终解决问题的方法。我使用它作为构建文件:

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