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

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

问题描述

我正试图编写一个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?

推荐答案

如果要删除整个目录,则需要

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文件,则必须提供

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 Task语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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