• MsBuild 入门


    1.属性    PropertyGroup


          $符号调用,可以在XML中传参数,也可以在命令行中传入参数。

    D:msbuild est3.msbuild


    <
    Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <msginfo>hello world</msginfo> </PropertyGroup> <Target Name="yefengGreeting"> <Message Text="$(msginfo)"></Message> <Message Text="$(ProjectName)"></Message> </Target> </Project>



    D:msbuild>msbuild test3.msbuild /p:ProjectName=kfsmqoo

    TPV$@%L74]1ZZWNFS[5MZRP

    2.目标任务   Target

    默认编译第一个目标任务。 
          参数:/t:Target1;Target2 编译多个目标任务

    D:msbuildTarget.msbuild


    <
    Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <msginfo>Target1</msginfo> </PropertyGroup> <Target Name="Target1"> <Message Text="$(msginfo)"></Message> <Message Text="$(ProjectName)"></Message> </Target> <Target Name="Target2"> <Message Text="Target2"></Message> </Target> </Project>


    D:msbuild>msbuild Target.msbuild /t:Target1;Target2
    R7K_O}4ZS@F_KF6YVBNLOEK

    DependsOnTargets 目标任务依赖

    D:msbuildTarget.msbuild


    <
    Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <msginfo>Target1</msginfo> </PropertyGroup> <Target Name="Target3" DependsOnTargets="Target1;Target2"> <Message Text="Target3"></Message> </Target> <Target Name="Target1"> <Message Text="$(msginfo)"></Message> <Message Text="$(ProjectName)"></Message> </Target> <Target Name="Target2"> <Message Text="Target2"></Message> </Target> </Project>


    D:msbuild>msbuild Target.msbuild /t:target3;target2;target1
    以此执行的是的1,2,3
    1,2没有顺序关系,按照XML的从上到下依次执行,3等1,2执行完毕再执行 。结果如下:
    TM)1QFQ`SOQ6TLLXO%PP2WH

  • 相关阅读:
    【DDD】领域驱动设计实践 —— 架构风格及架构实例
    【DDD】领域驱动设计精要
    Zynq UltraScale+ cross compiler
    Platform device/driver注册过程 (转)
    static inline extern等概念
    (int argc, char *argv[]) 指针数组
    linux man 1,2,3 命令
    指针左值错误
    arm ds5 编译选项
    在JTAG菊花链拓扑对设备编程
  • 原文地址:https://www.cnblogs.com/kfsmqoo/p/4596769.html
Copyright © 2020-2023  润新知