用于删除文件的 MSBuild 任务语法 [英] MSBuild Task syntax for deleting files

查看:19
本文介绍了用于删除文件的 MSBuild 任务语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个 MSBuild 任务,该任务从我的生产构建脚本的 bin 文件夹中删除 Obj 目录和 PDB,但似乎无法使其正常工作.

I'm trying to write a MSBuild Task that deletes the Obj directory and PDBs from my bin folder on my production build scripts and can't seem to get it to work right.

有没有人有一个他们这样做或类似的例子,或者一个指向使用 MSBuild 删除文件和目录的简单示例的链接?

Does anyone have an example where they do this or similar, or a link to a simple example of removing files and a directory with MSBuild?

推荐答案

如果您要删除整个目录,则需要 RemoveDir 任务:

If you're looking to delete an entire directory you require the RemoveDir task:

<RemoveDir Directories="Path/To/Obj" />

如果你想从 bin 中删除 PDB 文件,你需要 删除任务:

And if you're wanting to delete the PDB files from bin you'll want the Delete task:

<Delete Files="Path/To/Bin/MyApp.pdb" />

请注意,您不能在删除任务中使用通配符,因此如果您有多个 pdb 文件,则必须提供 ItemGroup 作为参数.

Note that you cannot use wildcards in the Delete task, so if you have multiple pdb files you're have to provide an ItemGroup as an argument.

这篇关于用于删除文件的 MSBuild 任务语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆