zoukankan      html  css  js  c++  java
  • Notes on MSBuild

    • When building software applications, you will always need to know two pieces of information: what is being built and what build parameters are being used. Typically, files are being built, and these would be contained in MSBuild items. Build parameters, like Configuration or OutputPath, are contained in MSBuild properties.
    • When you declare static properties, they are always contained in a PropertyGroup element, which occurs directly within the Project element.
    1 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    2 <PropertyGroup>
    3 <AppServer>\\sayedApp</AppServer>
    4 </PropertyGroup>
    5 <PropertyGroup>
    6 <WebServer>\\sayedWeb</WebServer>
    7 </PropertyGroup>
    8 </Project>
    • MSBuild fundamentally has two execution elements: tasks and targets. A task is the smallest unit of work in an MSBuild file, and a target is a sequential set of tasks. A task must always be contained within a target.
    • When MSBuild is installed, you are given many tasks out of the box, such as Copy, Move, Exec, ResGen, and Csc. You can find a list of these tasks at the MSBuild Task Reference (http://msdn2.microsoft.com/en-us/library/7z253716.aspx).

    • Reserved properties:

    • Items are usually file-based references, but they can be used for other purposes as well. If you create a project using Visual Studio, you may notice that you see many ItemGroup elements as well as PropertyGroup elements. The Item Groupelement contains all the statically defined items. Static item definitions are those declared as a direct child of the Projectelement. Dynamic items are those defined inside a target. When you define a property, you are declaring a key-value pair, which is a one-to-one relationship. When you declare items, one item can contain a list of many values. In terms of code, a property is analogous to a variable and an item to an array.
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <ItemGroup>
      <SolutionFile Include="..\InsideMSBuild.sln" />
    </ItemGroup>
    <Target Name="PrintSolutionInfo">
      <Message Text="SolutionFile: @(SolutionFile)" />
    </Target>
    </Project>
    • MSBuild.exe Command-Line Usage

    • When you create an MSBuild file, you should follow these conventions for specifying the extension of the file:
    1. .proj      A project file
    2. .targets    A file that contains shared targets, which are imported into other files
    3. .props     Default settings for a build process
    4. .tasks     A file that contains UsingTask declarations
    • MSBuild processes the entire file for properties and items beforeany targets are executed.
    • When the MSBuild engine begins to process a build file, it is evaluated in a top-down fashion in a multi-pass manner. These passes are described in order in the following list:
    1. Load all environment and global properties, and toolset properties. In Microsoft Visual Studio 2010, for example, C++ defines several properties in the MSBuild 4.0 toolset.
    2. Evaluate properties and process imports as encountered
    3. Evaluate item definitions
    4. Evaluate items
    5. Evaluate using tasks
    6. Start build and reading targets

     

     

     

     

     

     

     

  • 相关阅读:
    两款开发辅助工具介绍
    探究Repository模式的两种写法与疑惑
    js 时间处理
    Jquery元素追加和删除
    js 格式验证总结
    jquery UI datepicker时间控件的使用
    jquery 实现 点击按钮后倒计时效果,多用于实现发送手机验证码、邮箱验证码
    JS 字符串编码函数(解决URL特殊字符传递问题):escape()、encodeURI()、encodeURIComponent()区别详解
    form表单和ajax表单提交(Html.BeginForm()、Ajax.BeginForm())的差别
    了解了这些才能开始发挥jQuery的威力(转)
  • 原文地址:https://www.cnblogs.com/jacobz/p/2480985.html
Copyright © 2011-2022 走看看