【问题标题】:SVN post-commit works only manuallySVN post-commit 只能手动工作
【发布时间】:2010-02-01 07:35:41
【问题描述】:

嗨,

我创建了一个名为 post-commit.bat 的批处理文件并将其放在 /hooks 目录下。

文件内容为:

TestCS.exe

exe文件内容为:

static void Main(string[] args)
    {

        try
        {
            // create a writer and open the file
            TextWriter tw = new StreamWriter("date.txt");

            // write a line of text to the file
            tw.WriteLine(DateTime.Now);

            // close the stream
            tw.Close();
        }
        catch { }
    }

当我双击 post-commit.bat 时,它会创建 date.txt 文件。

当我在 SVN 中提交时,它需要时间,并最终给我以下消息: alt text http://img688.imageshack.us/img688/3894/exception.jpg

可能是什么问题?

谢谢!

【问题讨论】:

    标签: svn tortoisesvn post-commit


    【解决方案1】:

    显而易见的做法是启动调试器并更好地了解问题所在。

    建议您应该为您的TextWriter 使用using 语句,并避免在不尝试记录错误的情况下捕获和吞下所有异常。

    真的是你的全部代码吗?你根本没有使用args?很难看出该代码如何导致IndexOutOfRangeException...

    【讨论】:

    • 我试过using语句,还是一样。甚至删除了字符串 args[]。还是一样。
    • 我想通了。运行 testCS.exe 时,它​​显然在 /SVNServer/bin 中查找文件,而不是在 hooks 文件夹中。在 bin 文件夹中,我有一个带有 IndexOutOfRangeException 的 testCS.exe 文件。谢谢。
    • 我几乎提到“你确定你正在运行你认为你正在运行的二进制文件”,但最后并没有打扰。哎呀。
    猜你喜欢
    • 2010-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-13
    相关资源
    最近更新 更多