I want to write a simple task which will update and commit source code that was Nightly build to SVN. I was on the msbuildtasks.tigris.org page, and downloaded the dll's but I have no idea how to write it. Could you please provide some basic samples?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Here is an example (taken from the MSBuild Community Tasks Build) that does exactly that:
<ItemGroup>
<CommitFiles Include="www\index.html" />
<CommitFiles Include="www\MSBuild.Community.Tasks.Nightly.zip" />
<CommitFiles Include="www\MSBuild.Community.Tasks.Nightly.msi" />
</ItemGroup>
<SvnCommit Targets="@(CommitFiles)" Message="AutoBuild"
Username="$(CommitUser)" Password="$(CommitPassword)">
<Output TaskParameter="Revision" PropertyName="Revision" />
</SvnCommit>
Of course you need to import the MSBUild Community tasks for this to work:
<Import Project="MSBuild.Community.Tasks.Targets" />
This example is only committing a couple of files, but by setting the Targets property on the task it could easily be more.
回答2:
We use nant and while there are svn specific tasks you have alot more control using an exec task.
If you install the svn client CLI onto your build server you will be able to use the exec task in MSBuild to run the svn update command. Here is a snippet from our Nant build script which I am sure you could easily adapt to an MSBuild script.
Hope this helps.