问题
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.
来源:https://stackoverflow.com/questions/1645253/msbuild-and-svn-update