MSBuild:使用 FileUpdate 任务或类似任务修改解决方案文件
我希望能够通过 MSBuild 删除解决方案文件中的项目引用。
我假设我可以使用 FileUpdate 任务来完成此操作;但是,我不确定您如何打开多行正则表达式功能。本质上,我需要删除引用,例如:删除 Project 和 EndProject 之间包含 DELETEME 的所有内容。我知道如果我知道如何打开多行功能,我可以使用单词边界。如果有人有更好的想法,也很受欢迎。谢谢:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DELETEME", "DELETEME.csproj", "{08F67FEA-5A63-4A46-B38F-
26EF15E003A9}"
EndProject
<FileUpdate
Files="PATH TO SOLUTION"
Regex="PATTERN"
ReplacementText=" " />
我在任何地方都找不到有关此任务参数的文档:/也许类似于 RegexOptions = "Multiline"
I would like to be able to delete a project reference in a solution file via MSBuild.
I am assuming I can do this using the FileUpdate task; however, I am not sure how you turn on the multiline regex feature. Essentially, I need to delete a reference such as: delete everything between Project and EndProject where those lines contain DELETEME. I know I can use word boundaries if I knew how to turn on the mulltiline feature. IF someone has a better idea that is welcome too. Thank you:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DELETEME", "DELETEME.csproj", "{08F67FEA-5A63-4A46-B38F-
26EF15E003A9}"
EndProject
<FileUpdate
Files="PATH TO SOLUTION"
Regex="PATTERN"
ReplacementText=" " />
I can't find documentation on the parameters of this task anywhere either :/ Maybe something like RegexOptions = "Multiline"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我个人更喜欢编写一个自定义活动来为我进行清理工作。
Ewald Hoffman 有一系列关于自定义 Team Build 工作流程的博客文章。第 5 部分特别描述了编写一个自定义活动来自动更新程序集版本,只需稍加更改即可应用于您的情况。
http://www.ewaldhofman.nl/post/2010/05/13/Customize-Team-Build-2010-e28093-Part-5-Increase-AssemblyVersion.aspx
I would personally prefer writing a custom activity which does the cleaning for me.
Ewald Hoffman has a series of blog posts about customizing Team Build workflows. Part 5 especially describes a writing a custom activity to automatically update assembly version, which, with a little change, can be applied to your situation.
http://www.ewaldhofman.nl/post/2010/05/13/Customize-Team-Build-2010-e28093-Part-5-Increase-AssemblyVersion.aspx