Manoj Jaiwal
Manoj Jaiwal

Reputation: 41

svn commit using TeamCity

I am using Visual studio and TeamCity tools. I have added project in TeamCity. When TeamCity project build succeeded, TeamCity automatically should commit new binaries from bin/Release folder to specifed SVN path(e.g svn:\abc.com\root\trunk ). Does any one know how can I achieve this? Please let me know the steps. Thanks in advance.

Upvotes: 4

Views: 3521

Answers (3)

Alen Wesker
Alen Wesker

Reputation: 245

Here is what we used in our CI--Can handle most cases for auto compiling binaries and auto resource packaging:

:Deleting all missing files
for /f "usebackq tokens=2*" %%%%i in (`svn st ^| findstr /R "^!"`) do svn del "%%%%i@"

:Add all valid files
for /f "usebackq tokens=2*" %%%%i in (`svn st ^| findstr /R "^?"`) do svn add "%%%%i@"

:This line is needed, otherwise svn may result in "outdated"
svn up --accept working .

:Final commit
svn commit . --non-interactive --no-auth-cache --trust-server-cert -m "Some comment: %build.counter%"

You can use all the upper lines in one task or separate each of them into tasks, which is better.

You may need to find out what's actually doing by reading the documents, and altering the lines on your own auto-commit as a customized task.

Upvotes: 0

Sergey K.
Sergey K.

Reputation: 25396

Add Command Line build step to your TC configuration, just after the primary build step, containing command commit_build.bat. Create a commit_build.bat file that will commit your artifacts to SVN with the standard svn commands.

Don't forget to commit commit_build.bat into the repo.

Upvotes: 1

Rawrgramming
Rawrgramming

Reputation: 1505

Our build process includes a "Tag" MsBuild step after the building and unit testing steps are completed. this step cleans up any extra files from the build (e.g. unnecessary external dependencies if you are building a project to be referenced elsewhere) and commits the binaries. this is simply an MsBuild step which runs an MsBuild script tagging the built projects.

you can obtain the list of DLLs the project builds using the TargetOutputs element of the MsBuild call in your script, for example:

<MSBuild Projects="yourSolutions" Targets="Rebuild" Properties="Configuration=Release;Platform=x86">
    <Output ItemName="BinaryOutputs" TaskParameter="TargetOutputs"/>
</MSBuild>

you can then use standard svn commands to commit your files.

Upvotes: 0

Related Questions