C# 使用NANT构建子项目
我正在尝试使用NANT构建一个项目(a)。项目(A)依赖于另一个项目(B),该项目也是与NANT一起建造的。我希望能够从项目(A)的构建中调用依赖项目(B)的构建。我已尝试将项目B的生成文件包含在项目A的生成文件中。这会产生错误,因为这两个生成文件包含共享相同名称的目标C# 使用NANT构建子项目,c#,.net,nant,C#,.net,Nant,我正在尝试使用NANT构建一个项目(a)。项目(A)依赖于另一个项目(B),该项目也是与NANT一起建造的。我希望能够从项目(A)的构建中调用依赖项目(B)的构建。我已尝试将项目B的生成文件包含在项目A的生成文件中。这会产生错误,因为这两个生成文件包含共享相同名称的目标 有没有办法给包含的构建文件加上别名?我试图使用包含任务来实现这一点,但发现nant任务实际上就是我所需要的。您可以通过创建一个“父”构建文件来实现这一点,该文件使用“nant”操作调用其他构建文件 <target name
有没有办法给包含的构建文件加上别名?我试图使用包含任务来实现这一点,但发现nant任务实际上就是我所需要的。您可以通过创建一个“父”构建文件来实现这一点,该文件使用“nant”操作调用其他构建文件
<target name="rebuild" depends="" >
<nant target="${target::get-current-target()}">
<buildfiles>
<include name="projectB.build" />
<include name="projectC.build" />
</buildfiles>
</nant>
</target>
您的“主”文件中可以有几个这样的目标。我经常使用以下构造在目标之间共享一组构建文件,以使脚本维护更容易
<fileset id="buildfiles.all">
<include name="projectB.build"/>
<include name="projectB.build"/>
</fileset>
<target name="build">
<nant target="${target::get-current-target()}">
<buildfiles refid="buildfiles.all" />
</nant>
</target>
<target name="clean">
<nant target="${target::get-current-target()}">
<buildfiles refid="buildfiles.all" />
</nant>
</target>
<target name="publish">
<nant target="${target::get-current-target()}">
<buildfiles refid="buildfiles.all" />
</nant>
</target>