SVN post commit只能手动工作

SVN post commit只能手动工作,svn,tortoisesvn,post-commit,Svn,Tortoisesvn,Post Commit,嗨 我创建了一个名为post-commit.bat的批处理文件,并将其放在/hooks目录下 该文件的内容是: TestCS.exe static void Main(string[] args) { try { // create a writer and open the file TextWriter tw = new StreamWriter("date.txt"); /

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

该文件的内容是:

TestCS.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 { }
    }
exe文件的内容是:

TestCS.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中提交时,这需要时间,并最终给我以下消息:

有什么问题吗


谢谢

显而易见的做法是启动调试器,更好地了解问题发生的位置

我建议您对
TextWriter
使用
using
语句,避免捕获和吞咽所有异常,甚至不尝试记录错误


这真的是你的全部代码吗?您根本没有使用
args
?很难看出该代码将如何导致
索引自动失效异常
..

显而易见的做法是启动调试器并更好地了解问题发生的位置

我建议您对
TextWriter
使用
using
语句,避免捕获和吞咽所有异常,甚至不尝试记录错误


这真的是你的全部代码吗?您根本没有使用
args
?很难看出该代码将如何导致
索引自动失效异常

我已经尝试过using语句,仍然是一样的。甚至删除了字符串args[]。还是一样,我想出来了。运行testCS.exe时,它显然在/SVNServer/bin中查找文件,而不是在hooks文件夹中。在bin文件夹中,我有一个带有IndexOutOfRangeException的testCS.exe文件。谢谢。我差点提到“你确定你正在运行你认为正在运行的二进制文件吗?”但最后没有说。哎呀,我试过using语句,还是一样。甚至删除了字符串args[]。还是一样,我想出来了。运行testCS.exe时,它显然在/SVNServer/bin中查找文件,而不是在hooks文件夹中。在bin文件夹中,我有一个带有IndexOutOfRangeException的testCS.exe文件。谢谢。我差点提到“你确定你正在运行你认为正在运行的二进制文件吗?”但最后没有说。哎呀。