SVN Error : “svnadmin: E205000: Too many arguments”
Domanda
I am trying to back up my reposotries using a C# Code
Process svnCommand = null;
var psi = new ProcessStartInfo("svnadmin");
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.UseShellExecute = false;
psi.Arguments= @"dump C:\Repositories\Myrepo > C:\temp\myrepodumpfile.dump";
using (svnCommand = Process.Start(psi))
{
var myoutput = svnCommand.StandardOutput;
var myerror = svnCommand.StandardError;
Debug.Write("Output :" + Environment.NewLine +
Environment.NewLine + myoutput.ReadToEnd() +
Environment.NewLine + "Error :" +
Environment.NewLine + Environment.NewLine +
myerror.ReadToEnd());
svnCommand.Close();
}
When i use the dump command from the commandline
svnadmin dump C:\Repositories\Myrepo > C:\temp\myrepodumpfile.dump
it works fine but when i try to use it through C# code given above it gives error as
svnadmin: E205000: Try 'svnadmin help' for more info
svnadmin: E205000: Too many arguments
My SVN info :
SVN version 1.7.5 Environment variable aslo set (i can use sv directly from cmd)
Cant seem to figure out whats the problem
Soluzione
>
is a feature of the command line; you can't use it when launching a process from C#.
What >
does is it takes the output that the process writes to StandardOutput and writes it to a file. That's what you need to also implement in your program, e.g.
var psi = new ProcessStartInfo("svnadmin");
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
psi.UseShellExecute = false;
psi.Arguments= @"dump C:\Repositories\Myrepo";
using (var svnCommand = Process.Start(psi))
{
var myoutput = svnCommand.StandardOutput;
File.WriteAllText(@"C:\temp\myrepodumpfile.dump", myoutput.ReadToEnd());
svnCommand.WaitForExit();
}