MSBuild-从简单的配置文件动态生成属性 [英] MSBuild - dynamically generate properties from simple config file

查看:50
本文介绍了MSBuild-从简单的配置文件动态生成属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何将任务扩展到

读取一个简单的配置文件

read in a a simple config file

       keyaa = aaaaa

        keyaa = aaaaa

       keybb = bbbbb

        keybb = bbbbb

 

并动态生成属性,因此$(keyaa) 返回aaaaa

and generate properties dynamically so $(keyaa)  returns aaaaa

以便它们在全球范围内可用

so that they are available globally

 

推荐答案

爱德华,

 

感谢您的帖子.

据我所知,我们没有't提供此类官方任务来读取配置文件.

但是您可以尝试提供的XmlRead任务通过MSBuild社区任务

http://msbuildtasks.tigris.org/

http://msbuildtasks.tigris.org/

用法如下:

< XmlRead  
XPath = /Foo/@ StringValue
XmlFileName = "app.config" >  
  <输出 TaskParameter = 值" PropertyName = "MyStringValue"; />  
</XmlRead>  
<消息 文本 = ""MyStringValue:

<XmlRead  
  XPath=/Foo/@StringValue 
  XmlFileName="app.config"> 
    <Output TaskParameter="Value" PropertyName="MyStringValue" /> 
</XmlRead> 
<Message Text="MyStringValue:


(MyStringValue)" />  
(MyStringValue)"/> 

希望我的回复有助于解决您的问题.

 

最好的问候,

Ziwei Chen

此回复包含对第三方世界的引用宽网站. Microsoft为方便您而提供此信息.微软不控制 这些网站,尚未测试在这些网站上找到的任何软件或信息;因此,Microsoft无法对在此找到的任何软件或信息的质量,安全性或适用性做出任何陈述.存在着内在的危险 使用Internet上发现的任何软件,Microsoft提醒您在从Internet上检索任何软件之前,请确保您完全了解风险.

This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


这篇关于MSBuild-从简单的配置文件动态生成属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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