我正在使用MSDN中的示例代码进行文件同步。但是我收到了错误
错误CS1729:'Microsoft.Synchronization.Files.FileSyncProvider'确实如此 不包含为以下内容采用3个参数的构造函数 下面给出的方法中的行:
sourceProvider = new FileSyncProvider(sourceReplicaRootPath, filter, options);
destinationProvider = new FileSyncProvider( destinationReplicaRootPath, filter, options);
public static void SyncFileSystemReplicasOneWay( string sourceReplicaRootPath, string destinationReplicaRootPath, FileSyncScopeFilter filter, FileSyncOptions options)
{
FileSyncProvider sourceProvider = null;
FileSyncProvider destinationProvider = null;
try
{
sourceProvider = new FileSyncProvider(sourceReplicaRootPath, filter, options);
destinationProvider = new FileSyncProvider( destinationReplicaRootPath, filter, options);
destinationProvider.AppliedChange +=
new EventHandler<AppliedChangeEventArgs>(OnAppliedChange);
destinationProvider.SkippedChange +=
new EventHandler<SkippedChangeEventArgs>(OnSkippedChange);
SyncOrchestrator agent = new SyncOrchestrator();
agent.LocalProvider = sourceProvider;
agent.RemoteProvider = destinationProvider;
agent.Direction = SyncDirectionOrder.Upload; // Sync source to destination
Console.WriteLine("Synchronizing changes to replica: " +
destinationProvider.RootDirectoryPath);
agent.Synchronize();
}
finally
{
// Release resources
if (sourceProvider != null) sourceProvider.Dispose();
if (destinationProvider != null) destinationProvider.Dispose();
}
}
问题:如果我检查FileSyncProvider
FileSyncProvider
,那么我可以看到一个接受3个参数的构造函数,但是如果我转到定义在VS2010中FileSyncProvider
,我没有看到{% cache 300 header %} ... {% endcache %} # 300 seconds
的任何构造函数接受3个参数(当然这就是我得到错误的原因)。