人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

June 10, 2006

听Alen讲MS Build

Filed under: Visual Studio

1. MS Build的位置
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

2. 相关namespace
Microsoft.Build.Framework
Microsoft.Build.Engine
Microsoft.Build.Utilities

3. MS build的 4个要素:
Target : task的组合
<Target Name=”Build”>
<Task1 Property1=”XX” Property2=”XXX”>
<Output TaskParameter=”NewVersion” PropertyName=”ET4NewVersion” />
</Task1>

<Testn> </Testn>

</Target>

Task : 可复用的执行单元, 由脚本和dll协同工作

<UsingTask TaskName=”VssGet” AssemblyFile=”$(DLL)” />

<Target Name=”Build”>
<VssVersion VssIni=”$(VssIni)” Property2 =”XXXX”>
<Output TaskParameter=”NewVersion” PropertyName=”ET4NewVersion” />
</VssVersion>
</Target>

public class VssGet : Microsoft.Build.Utilities.Task
{
//
// Properties….
//
[Required] //从脚本中读取
public string ProjectPath
{
get
{
return _projectPath;
}
set
{
_projectPath = value;
}
}

[Output]
public string Date
{
get
{
return DateTime.Today.ToShortDateString();
}
}
public override bool Execute()
{
}
}
Property: key-value 对,用来对build进行配置
<PropertyGroup>
<BuildDir>Build</BuildDir>
<DLL>..\GrapeCity.DailyBuild.dll</DLL>
</PropertyGroup>

使用property
<UsingTask TaskName=”XCopy” AssemblyFile=”$(DLL)” />
<XCopy Projects=”@(PublishOutputPath)” Destination=”$(TargetFolder)\LastBuild\Publish”/>

Item : Task的参数

4. 在命令行传入参数
MSBuild.exe MyProj.proj /property:Configuration=Debug

5. 执行外部命令
<PropertyGroup>
<EncryptPath>”D:\Work\DailyBuild\”</EncryptPath>
</PropertyGroup>

<Target Name=”Encrypt”>
<Exec IgnoreExitCode=”True”
Command=”$(EncryptPath)\Encrypt.bat”/>
</Target>

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/06/10/p101/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham