是否有任何 MSbuild 任务来检查一个字符串是否包含另一个字符串(类似于 string.contains)
我有这个 Msbuild 代码:
<Import Project="A.proj" Condition="$(BuildDefinition) =='Dist Staging to Dev' Or $(BuildDefinition) =='Dist Staging to Dev(Services Only)'"/>
但我想知道是否有类似的内容来检查字符串是否包含某些文本以获得类似的内容:
<Import Project="A.proj" Condition="$(BuildDefinition) CONTAINS 'Dist Staging to Dev'"/>
I have this Msbuild code:
<Import Project="A.proj" Condition="$(BuildDefinition) =='Dist Staging to Dev' Or $(BuildDefinition) =='Dist Staging to Dev(Services Only)'"/>
But I was wondering if is there anything similar to check if an string contains some text to get something similar to:
<Import Project="A.proj" Condition="$(BuildDefinition) CONTAINS 'Dist Staging to Dev'"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您使用 MSBuild 4,则可以使用
Property function
(有关属性功能的更多信息)
If you use MSBuild 4, you could use
Property function
(More info on Property function)
MSBuild4: 正如 Julien 所说,在 MSBUILD 4 中可以使用属性函数。
MSBuild 3.x:在以前的版本中,如果您使用Tigris MsBuild Tasks,
则 可以可以使用任务RegexMatch并使用正则表达式
MSBuild4: As Julien said, in MSBUILD 4 is possible to user Property Function.
MSBuild 3.x: In previous versions is possible if you use Tigris MsBuild Tasks
You can use task RegexMatch and use a regular expression
MsBuild 条件参考 没有任何关于“的可能性”包含”功能。看起来您的第一个版本是唯一的选择。
MsBuild Conditions reference doesn't have anything about a possibility of a "contains" function. Looks like your first version is the only option.