Recently I was working with Dependency Replicator and I ran into an issue.
Background
The file that is the “dependency” does not exist in the destination yet. Therefore the replicator fails. If it does not find the destination file in the dependent project location it will fail. In English: In $/TeamProject/Main/SharedBinaries/ there was no “utility.dll”. However, this is EXACTLY where I wanted replicator to PUT the file. Since the file did not exist at the destination, I would receive this error in the event log:
———————————–
Error in Event Viewer:Dependency Repliccator error:
Event Type: Error
Event Source: DependencyReplicator
Event Category: None
Event ID: 0
Date: 10/23/2008
Time: 11:24:30 AM
User: N/A
Computer: TFSSERVER
Description:
An error occured processing the dependency ‘$/TeamProject/Path/To/Dependency/dependency.dll’ from build ‘TeamProject_CI_20081023.5’ in project ‘TeamProject’. Processing subsequent rules will continue:
System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\DependencyReplicator\TeamProject\Path\To\Dependency\Dependency.dll’.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
at DependencyReplicator.BuildStoreWatcher.ExecuteDependencyReplicationRule(Rule rule, Workspace workspace)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.———————
Steps to recreate:
- Create two team projects
- – One being the one which will propogate the dependency (ex: shared utility dll or something). This would output a file called “utility.dll” which would then
be propogated to other locations. - Other being the project which utilizes the dependency “MytestProject”. DO NOT put the dependency (utility.dll) in this team project anywhere.
- – One being the one which will propogate the dependency (ex: shared utility dll or something). This would output a file called “utility.dll” which would then
- Set Depdenency Replicator xml to have the utility.dll file placed somewhere in “MyTestProject”.
- Kick off a build for the utililty project. This should kick off the dependency repliccator.
- Error (above) occurs.
Work Around
Place a copy of the “utility.dll” into the destination where the dependency should be. From that point forward you will not have a problem.
The Real Fix
The real fix is to fix the source code. Since I’m not a developer on the project I whipped up this code (which please note is only POC at this time).
string fullyQualifiedSource = Path.Combine(rule.Event.Data.DropLocation, rule.Source); string fullyQualifiedDestination = workspace.GetLocalItemForServerItem(rule.Destination); if(status.NumOperations != 0) { workspace.PendEdit(rule.Destination); File.Copy(fullyQualifiedSource, fullyQualifiedDestination, true); } else { File.Copy(fullyQualifiedSource, fullyQualifiedDestination, true); workspace.PendAdd(rule.Destination); }
I’m going to build this hopefully later this week and submit it to the project. ๐
Leave a Reply
You must be logged in to post a comment.