SharpSvn - SharpSvn.SvnFormatException: Can't determine the user's config path

Till the beginning of this month, I was a regular SVN user using SVN as my Version Control System for many projects. But then, somewhere in the second week of this month, I have turned a SVN developer (not writing code for SVN itself, but providing solutions off SVN).

For one of the projects code-named Zone, I began writing a module for SVN integration to provide seamless access to local or remote SVN repositories. Without second thought, CollabNet's open-source SharpSvn library was my library of choice for SVN development.

However my first attempt at fetching log from a remote svn repo failed with the following exception:

SharpSvn.SvnFormatException: Can't determine the user's config path

SharpSvn's bundled documentation is good, but not that great. And googling also did not reveal much about this problem. In bits and pieces, I was able to conclude that this exception probably had to do with the missing SVN configuration path (which is a directory for holding run-time configuration information for Subversion clients).

So, do I needed to create this directory or SharpSvn would do it for itself, or is there any specific layout for this directory, etc. were the questions lurking in my mind at that point. One thing that was sure was because the code was executing as a part of ASP.NET application, it cannot and should not use a regular interactive user's Subversion configuration path. And neither should it try to create a new directory somewhere in an interactive user's folders (As a Windows 7 user, my Windows account's Subversion configuration directory is located at: C:\Users\Rahul Singla\AppData\Roaming\Subversion).

Some quick browsing through the SharpSvn's API in Visual Studio's Object Browser, I was able to figure out the LoadConfiguration method on the main SvnClient class. So, the following method call before trying to connect to a remote repo resolved the exception I was getting:


{syntaxhighlighter brush: csharp;fontsize: 100; first-line: 1; }using (SvnClient client = new SvnClient()) { client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"), true); //....More code{/syntaxhighlighter}

Here, I am using sub-directory under Windows temporary directory for the ASP.NET application user account's svn configuration path. You might want to use a sub-directory under your application root, or another permanenet folder preferably.

Stay tuned for more SharpSvn blog posts...



Are you running SharpSvn as part of a web project, or something else that runs as a different user? When using SharpSvn in an application that's running under your own credential, LoadConfiguration call shouldn't be necessary.

See this for an explanation

rahul's picture

Hi Sander, yes my code is running as a web app, notice this in the blog post: "One thing that was sure was because the code was executing as a part of ASP.NET application"

Ah I missed that part, sorry about that. But yes, that's the reason you need to call that method explicitly.

Tks man! I had no ideia what could be!


Hey, I am using ur "Client.LoadConfiguration()" method its working but after some time my folder gets automatically deleted from my appDirectory.

And i m using it as web app in c#.

I need that folder to be permanently created in that appDirectory.

Can you help ASAP?

rahul's picture

Hi, it must be something in your setup that must be deleting the folder, SharpSVN won't delete it (atleast it hasn't done so for me). I can't help further except for advicing to double-check your code. You can try playing with permissions of the folder and deny Write/Delete permissions for all and hope you would get a Windows Event Log entry on failure to delete the directory because of insufficient permissions in case something outside your application is deleting that folder.

Just wanted to say thanks, this solved the exact same issue i was having :).

Gotta love the internet.

Thanks! Smile