2012-09-05 35 views
1

我的钩后提交模板叫我postcommitlog.exe创建MyFile_LOG.txt和写入的3个参数。存储库和事务从postcommit模板传递。无法从钩子程序调用创建日志文件

的问题是,犯TurtoiseSVN文件后,没有创建日志。它看起来像是我没有权限在存储库上创建文件,或者我的代码中有错误。

我的代码工作在本地,当我调试它,并通过随机参数给它,是我的本地机器上创建一个日志文件。但它没有在SVN挂钩上工作。

模板

\\myserver\e$\Repositories\CONRAD\hooks\postcommitlog.exe %1 %2 

我的程序

using System; 
using System.IO; 

namespace postcommitlog 
{ 
    internal class Program 
    { 
     private static void Main(string[] args) 
     { 
      string repositories = args[0]; 
      string transaction = args[1]; 

      const string LOG_PATH = @"\\myserver\e$\Repositories\CONRAD\hooks\MyFile_LOG.txt"; 

      FileInfo fileInfo = new FileInfo(LOG_PATH); 

      File.AppendAllText(LOG_PATH, "Repositories " + args[0] 
       + "\t Transaction " + args[1] + "\t Date " + DateTime.Now.ToString("MMM ddd d HH:mm yyyy") + Environment.NewLine); 
     } 
    } 
} 

回答

0

您可能会运行到权限问题。有一个如何使用凭据访问共享文件夹here的示例。

+0

感谢 我尝试了,我得到这个错误: 未知错误 “1346”。 代码转到catch块并给我错误。 –