Lov*_*pta 0 xml nant xcopy build command-prompt
之前我的dot-net项目部署到我的远程服务器,我在一个nant构建配置文件中使用了copy命令.该命令如下所示.
<target name="Deploy">
<copy todir="${path.to.the.directory}" overwrite="true">
<fileset basedir="${Bin.Path}">
<include name="*.*" />
</fileset>
</copy>
</target>
Run Code Online (Sandbox Code Playgroud)
现在,当我的项目增长时,我的$ [bin.path]文件夹中有两个新文件夹,现在我无法使用复制命令将我的可执行文件复制到输出文件夹.
有人可以建议我做什么.
搜索后我发现我可以使用XCopy.但我没有得到如何将其集成到我的构建脚本中,类似于上面显示的那样.
谢谢你的帮助.
我想知道为什么你得出的结论是你不能使用<copy>
任务.
如果需要将子文件夹包含在副本集中,请将NAnt脚本更改为:
<target name="Deploy">
<copy todir="${path.to.the.directory}" overwrite="true">
<fileset basedir="${Bin.Path}">
<include name="**\*.*" />
</fileset>
</copy>
</target>
Run Code Online (Sandbox Code Playgroud)
如果您不想将文件夹结构保留在目标目录中,则可以使用task的flatten
属性<copy>
:
<target name="Deploy">
<copy todir="${path.to.the.directory}" overwrite="true" flatten="true">
<fileset basedir="${Bin.Path}">
<include name="**\*.*" />
</fileset>
</copy>
</target>
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助.