来自MSBuild的SharpSVN错误
本文关键字:错误 SharpSVN MSBuild 来自 | 更新日期: 2023-09-27 18:07:44
我有以下代码来使用SharpSVN从Subversion获取更改的文件列表。
代码在单元测试中工作得很好,但在MSBuild中运行时失败。单元测试和MSBuild都使用相同的参数运行(我已经通过调试两者进行了检查),并且在同一用户下运行。在GetLog
内部引发错误异常,(GetInfo
成功,其他SVN方法在其他地方工作)。
任何想法?
代码:public IEnumerable<string> GetChangedFiles(long revisionNumber)
{
using (var client = new SvnClient())
{
SvnInfoEventArgs info;
client.GetInfo(_workingCopyPath, out info);
var lastRevision = info.LastChangeRevision;
Collection<SvnLogEventArgs> logItems;
var args = new SvnLogArgs();
args.RetrieveChangedPaths = true;
if (revisionNumber > lastRevision)
{
throw new ArgumentException(string.Format(
"Revision number ({0}) is greater than last revision ({1})",
revisionNumber, lastRevision));
}
args.Range = new SvnRevisionRange(revisionNumber, lastRevision);
client.GetLog(_workingCopyPath, args, out logItems);
return logItems.SelectMany(li => li.ChangedPaths).Select(cp => cp.Path);
}
}
和例外:
System.Runtime.InteropServices.SEHException was unhandled by user code
Message=External component has thrown an exception.
Source=SharpSvn
ErrorCode=-2147467259
StackTrace:
at svn_client_log5(apr_array_header_t* , svn_opt_revision_t* , apr_array_header_t* , Int32 , Int32 , Int32 , Int32 , apr_array_header_t* , IntPtr , Void* , svn_client_ctx_t* , apr_pool_t* )
at SharpSvn.SvnClient.InternalLog(ICollection`1 targets, Uri logRoot, SvnRevision altPegRev, SvnLogArgs args, EventHandler`1 logHandler)
at SharpSvn.SvnClient.Log(String targetPath, SvnLogArgs args, EventHandler`1 logHandler)
at SharpSvn.SvnClient.GetLog(String targetPath, SvnLogArgs args, Collection`1& logItems)
at MSBuild.CustomTasks.SVN.Svn.GetChangedFiles(Int64 revisionNumber)
at MSBuild.CustomTasks.SVN.SvnCopy.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)
InnerException:
我找到了解决方案,尽管它非常适合我的情况。
当我部署我的CustomTask时,我忘记部署SharpSvn-SASL21-23-Win32.dll(它在从单元测试运行时存在)。