• SharpSVN出错信息:Can't determine the user's config path,从此证明了百度是个垃圾


    找了半天没找到问题,从Google一搜就看到了,速度解决之!

    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:

    1 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:

    1 using (SvnClient client = new SvnClient())
    2 {
    3   client.LoadConfiguration(Path.Combine(Path.GetTempPath(), "Svn"),true);
    4 //....More code

    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...

  • 相关阅读:
    面试题:JS中map的陷阱
    C#中正则表达式进行忽略大小写的字符串替换
    C#窗体钉在桌面、置底、嵌入桌面的办法
    创建C#串口通信程序详解
    为类和函数代码自动添加版权注释信息
    C# 如何编辑文件的摘要信息
    C# GDI在控件上绘图
    泛型Dictionary的用法详解
    Winform 导出成Excel打印代码
    C#反射深入学习
  • 原文地址:https://www.cnblogs.com/goody9807/p/2853182.html
Copyright © 2020-2023  润新知