English 中文(简体)
隐藏的特性msbuild[关闭]
原标题:
  • 时间:2009-05-10 21:03:15
  •  标签:
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.

这周我有一个兴趣msbuild。我清理了很多极其复杂的构建脚本。挖掘惊喜我能做多少钱- msbuild。net编程是一种隐藏的特性。

所以公约的问题必须有答案,在几天或一个星期,我马克最酷最有用的或隐藏的特性(s)接受。

   let bestAnswer suprise slick useful = (surprise + slick + 2*useful)

有用的定义:我更新现有的msbuild脚本:包(zip文件)网站和公用事业,CC.NET集成,启动测试(UT +硒),建立数据库。我添加(新目标,更有用的):部署VMWare虚拟服务器,连接构建(立即快速构建,队列缓慢的测试)。如果你是指外部库(如< a href = " http://msbuildtasks.tigris.org/ " rel = " nofollow noreferrer " > < / >社区MSBuild任务),这将是很高兴知道如何得到它。

< >强一些我已经发现msbuild惊喜。< / >强

  • Hello world using the Message task and Properties.
  • Using msbuild as an installer for an extremely complex server product. MSB community tasks managed IIS server setup. The WriteLinesToFile and XmlUpdate tasks wrote server specific configuration files. If you ve work with MSI, you ll know that anything is better than MSI for installation.
  • For newbies: CSProj and Vbproj files are the same as msbuild "proj" files. To edit directly: Unload your csproj or vbproj, then right click project and select edit. This is nicer and more powerful than working with clunky pre-build / post-build events.
  • MSBuild comes with the generic .NET installation. Unlike other fancy tools, you can use it on a totally clean server / desktop.

Here is msbuild Hello World After I wrote it, I found the MSDN hello world.

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build;Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
       <Who>World</Who>
  </PropertyGroup>
  <Target Name="Hello">
    <Message Text="Hello, $(Who)" Importance="high" ></Message>
  </Target>
  <Target Name="Build" DependsOnTargets="Hello"/>
  <Target Name="Test"/>
</Project>
问题回答

MSBuild有很多很好的功能。我喜欢

recursive file specs

<Files Include="$(src)***.cs" Exclude="$(src)***test.cs" />

批处理和项目元数据

<ItemGroup>
 <F Include="SampleApplication.t">
    <Version>1</Version>
</F>
 <F Include="SampleApplication2.t">
    <Version>1</Version>
</F>
<F Include="SampleApplication3.t">
   <Version>2</Version>
</F>
</ItemGroup>
<Target Name="Build">
<Touch Files="%(F.FullPath)" AlwaysCreate="True" 
        Condition="  %(F.Version)  >  1  ">
<Output TaskParameter="TouchedFiles" ItemName="CreatedFiles"/>
</Touch>
<Message Text="Created files = @(CreatedFiles)"/>
<Message Text="%(F.Identity) %(F.Version)"/>
</Target>

目标级依赖关系分析

<Target Name="Build"
           Inputs="@(MyItems)"
           Outputs="@(MyItems ->  $(MyItems)\%(filename).dll ">

这不是一个隐藏的功能,但我认为< a href = " http://msdn.microsoft.com/en-us/library/ms171473 (VS.80) . aspx“rel = " nofollow noreferrer " >配料< / >是非常强大的,当理解。

你可以阅读我的博客条目相关的更多信息:

赛义德易卜拉欣Hashimi

我的书:< a href = " https://rads.stackoverflow.com/amzn/click/com/0735626286 " rel = " nofollow noreferrer " >在微软构建引擎:使用MSBuild和团队基础构建< / >

使用<强> / M < /强>命令行参数来启用使用所有可用的CPU核。

  • I have found the MSBuild Extension pack to be incredibly useful. The documentation is very well organized and easy to find the info you need.

  • 他们已经为构建文件配置智能感知的部分,可以发现< a href = " http://www.msbuildextensionpack.com/help/3.5.2.0/Configuring%20Intellisense.htm " rel = " nofollow noreferrer " > < / >在这里

  • Attrice has an incredible tool that I use often if I need to work on build scripts. What makes it worth your while to try it out, is that it has a debugger that will show you the dependent tasks, as it executes your build script, with auto s and watch variables while it is running the build script. Microsoft Build Sidekick v2.3

  • 设置SVN安静,这个感觉我增加的速度构建过程。MSBuild.Community.Tasks.Subversion添加以下。SvnExport将运行构建没有日志记录每个文件的SVN

    参数= " -力- q "

你可以参考一个msbuild文件在另一个。我们所有的目标,比如运行NCover SourceMonitor,得宝等在一个共同的目标文件。对于每个项目,我们创建一个msbuild文件PropertyGroup和ItemGroup部分,其次是一个包含共同的目标。这可以保证我们所有的构建将运行相同的分析任务,节省我们的时间编写脚本。





相关问题
热门标签