Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1004027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:04:07+00:00 2026-05-16T08:04:07+00:00

I’m trying to automate svnadmin dump using C# ProcessStartInfo. The way I’ve done it

  • 0

I’m trying to automate svnadmin dump using C# ProcessStartInfo.

The way I’ve done it on the command line is like so,

svnadmin dump c:\Repositories\hackyhacky > c:\backup\hackyhacky.svn_dump

Works a treat and dumps successfully, and I can verify this by restoring it into another repository like so

svnadmin load c:\Repositories\restore_test < c:\backup\hackyhacky.svn_dump

Which restores successfully – yay!

Now… I need to replicate the command line piping into another file using C#, but for some reason

var startInfo = new ProcessStartInfo(Path.Combine(SvnPath, "svnadmin"),"dump c:\Repositories\hackyhacky")
 {CreateNoWindow = true, RedirectStandardOutput = true,RedirectStandardError = true,UseShellExecute = false};
process.StartInfo = startInfo;
process.Start();
StreamReader reader = process.StandardOutput;
char[] standardOutputCharBuffer = new char[4096];
byte[] standardOutputByteBuffer;
int readChars = 0;
long totalReadBytes = 0;

// read from the StandardOutput, and write directly into another file

using (StreamWriter writer = new StreamWriter(@"C:\backup\hackyhacky.svn_dump", false)) {
    while (!reader.EndOfStream) {
       // read some chars from the standard out
       readChars = reader.Read(standardOutputCharBuffer, 0, standardOutputCharBuffer.Length);

       // convert the chars into bytes
       standardOutputByteBuffer = reader.CurrentEncoding.GetBytes(standardOutputCharBuffer);

       // write the bytes out into the file
       writer.Write(standardOutputCharBuffer.Take(readChars).ToArray());

       // increment the total read
       totalReadBytes += standardOutputByteBuffer.Length;
    }                    
}

Dumps the same repo into hackyhacky.svn_dump.

But when I run my load command line now

svnadmin load c:\Repositories\restore_test < c:\backup\hackyhacky.svn_dump

I get a checksum error weird-error!

svnadmin load c:\Repositories\restore_test < c:\backup\hackyhacky.svn_dump
< Started new transaction, based on original revision 1
     * adding path : Dependencies ... done.
     * adding path : Dependencies/BlogML.dll ...svnadmin: Checksum mismatch, fil
e '/Dependencies/BlogML.dll':
   expected:  d39863a4c14cf053d01f636002842bf9
     actual:  d19831be151d33650b3312a288aecadd

I’m guessing this is to do with how I’m redirecting and reading the StandardOutput.

Does anyone know the right way to mimic the command line file piping behaviour in C#?

Any help is greatly appreciated.

-CV

UPDATE

I’ve tried using a BinaryWriter and using the standardOutputByteBuffer to write to the file, but that doesn’t work either. I get a different error about incorrect header format or something.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:04:08+00:00Added an answer on May 16, 2026 at 8:04 am

    Alright! If you can’t beat em, join em….

    I found a post where the author pipes to a file directly within the Process StartInfo, and claims it works.

    http://weblogs.asp.net/israelio/archive/2004/08/31/223447.aspx

    It didn’t work for me, as described in another gentleman’s post

    http://webcache.googleusercontent.com/search?q=cache:http://www.deadbeef.com/index.php/redirecting_the_output_of_a_program_to_a

    He writes a batch file first with the piping and then executes it…

    amWriter bat = File.CreateText("foo.bat"); 
    bat.WriteLine("@echo off"); 
    bat.WriteLine("foo.exe -arg >" + dumpDir + "\\foo_arg.txt"); 
    bat.Close(); 
    Process task = new Process(); 
    task.StartInfo.UseShellExecute = false; 
    task.StartInfo.FileName = "foo.bat"; 
    task.StartInfo.Arguments = ""; 
    task.Start(); 
    task.WaitForExit();
    

    In his words:

    Truly horrific, but it has the
    advantage of working!

    To be perfectly frank, I’m a bit annoyed this has taken me as long as it has, so the batch file solution works well so I’m going to stick with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.