I have investigated this in detail. A loooong way to do it is to use Windows Messaging Subsystem (windows event log - you create your own log and write messages to it). Asp.Net creates a message. Then you need to write a windows service which reads the messages every 3 seconds or so. The moment it comes across an 'update svn please message', you run your cmd.exe /c svn.exe blah blah from your freshly created windows service...it works very well, buts its a lot of work...Then there is SharpSVN lib, but it requires a bit of setup and you can run into problems. Finally, most people seem to be trying to use ProcessStartInfo class, but few seem to get it right...Yes, its not easy and a long way around but here's the code......Here's code that will run svn.exe for you and log all the screen output to output buffer....
private static int lineCount = 0;
private static StringBuilder outputBuffer = new StringBuilder();
private void SvnOutputHandler(object sendingProcess,
DataReceivedEventArgs e)
{
Process p = sendingProcess as Process;
// Save the output lines here
// Prepend line numbers to each line of the output.
if (!String.IsNullOrEmpty(e.Data))
{
lineCount++;
outputBuffer.Append("\n[" + lineCount + "]: " + e.Data);
}
}
private void RunSVNCommand()
{
ProcessStartInfo psi = new ProcessStartInfo("cmd.exe",
string.Format("/c svn.exe --config-dir=%APPDATA%\\Subversion --username=yrname --password=yrpassword --trust-server-cert --non-interactive update d:\\inetpub\\wwwroot\\yourpath"));
psi.UseShellExecute = false;
psi.CreateNoWindow = true;
// Redirect the standard output of the sort command.
// This stream is read asynchronously using an event handler.
psi.RedirectStandardOutput = true;
psi.RedirectStandardError = true;
Process p = new Process();
// Set our event handler to asynchronously read the sort output.
p.OutputDataReceived += SvnOutputHandler;
p.ErrorDataReceived += SvnOutputHandler;
p.StartInfo = psi;
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
p.WaitForExit();
}
Quick explanation on svn.exe arguments and why we do it...You need to specify config-dir to whatever account has checked out the svn dir. IIS runs under a different account. If it can't find the config file for svn, you will get a stop message. --Non-interactive and --trust-server-certificate is to basically skip the prompt to accept the security challenges. Finally, you will need to specify username and password as this for some reason does not get sent (with my version of svn.exe anyway). Now, on top of this, connecting via https to the svn server was giving me errors as the hostname reported by IIS is different to a desktop hostname (ssl cert mismatch), hence it does not like the hostname in the config file - go figure. So, I figured, that if I reverse proxy from http to https (so now I have two websites on one server, with one being reversesvn.domain.com:80 proxing to svn.domain.com:8443) This will skip on all the certificate issues and that was the final piece of the puzzle. Here's how to do it - simple : https://blog.ligos.net/2016-11-14/Reverse-Proxy-With-IIS-And-Lets-Encrypt.html.