diff --git a/src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs b/src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs index b1c5781515d..692f37de860 100644 --- a/src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs +++ b/src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs @@ -97,6 +97,16 @@ public void MakePathsRelativeTo(DirectoryInfo optionsFileDirectory) this.Inputs[idx] = new Uri(relPath, UriKind.Relative); } } + + // Update references + for (int idx = 0; idx < this.References.Count; idx++) + { + var reference = this.References[idx]; + if (reference.DependencyType == ProjectDependencyType.Project || reference.DependencyType == ProjectDependencyType.Binary) + { + this.References[idx].ReferenceIdentity = PathHelper.GetRelativePath(reference.FullPath, optionsFileDirectory, out relPath) ? relPath : reference.FullPath; + } + } } public void ResolveFullPathsFrom(DirectoryInfo optionsFileDirectory) @@ -116,6 +126,18 @@ public void ResolveFullPathsFrom(DirectoryInfo optionsFileDirectory) this.Inputs[idx] = fileUri; } } + + // Update references full path + for (int idx = 0; idx < this.References.Count; idx++) + { + var reference = this.References[idx]; + if (reference.DependencyType == ProjectDependencyType.Project || reference.DependencyType == ProjectDependencyType.Binary) + { + string fullPath = Path.GetFullPath(Path.Combine(optionsFileDirectory.FullName, reference.ReferenceIdentity)); + this.References[idx].FullPath = fullPath; + this.References[idx].ReferenceIdentity = fullPath; + } + } } } } diff --git a/src/dotnet-svcutil/lib/src/Shared/ProjectDependency.cs b/src/dotnet-svcutil/lib/src/Shared/ProjectDependency.cs index 8e392855b6f..4ba6b138400 100644 --- a/src/dotnet-svcutil/lib/src/Shared/ProjectDependency.cs +++ b/src/dotnet-svcutil/lib/src/Shared/ProjectDependency.cs @@ -43,7 +43,7 @@ internal class ProjectDependency : IComparable /// /// Assembly full path. /// - public string FullPath { get; private set; } + public string FullPath { get; set; } /// /// Assembly name. @@ -63,7 +63,7 @@ internal class ProjectDependency : IComparable /// /// The package identity, used for describing the dependency passed to Svcutil. /// - public string ReferenceIdentity { get; private set; } + public string ReferenceIdentity { get; set; } #region instance contruction methods // this ctr is private to ensure the integrity of the data which can be done only by the provided static instance creation (FromXXX) methods. @@ -153,7 +153,7 @@ private ProjectDependency(string filePath = "", string packageName = "", string this.ReferenceIdentity = this.DependencyType == ProjectDependencyType.Package || this.DependencyType == ProjectDependencyType.Tool || !string.IsNullOrWhiteSpace(packageName) ? string.Format(CultureInfo.InvariantCulture, "{0}, {{{1}, {2}}}", this.AssemblyName, this.Name, this.Version) : - this.FullPath; + filePath; this.IsFramework = this.Name == NetCoreAppPackageID || this.Name == NetStandardLibraryPackageID; } diff --git a/src/dotnet-svcutil/lib/tests/Baselines/MultiTargetTypeReuse/TypeReuseClient/ServiceReference/dotnet-svcutil.params.json b/src/dotnet-svcutil/lib/tests/Baselines/MultiTargetTypeReuse/TypeReuseClient/ServiceReference/dotnet-svcutil.params.json index db493e18ee4..04374f6339f 100644 --- a/src/dotnet-svcutil/lib/tests/Baselines/MultiTargetTypeReuse/TypeReuseClient/ServiceReference/dotnet-svcutil.params.json +++ b/src/dotnet-svcutil/lib/tests/Baselines/MultiTargetTypeReuse/TypeReuseClient/ServiceReference/dotnet-svcutil.params.json @@ -10,7 +10,7 @@ ], "outputFile": "Reference.cs", "references": [ - "$TEMP$MultiTargetTypeReuse//TypeReuseClient//bin//Debug//net6.0//BinLib.dll" + "../bin/Debug/net6.0/BinLib.dll" ], "targetFramework": "N.N", "typeReuseMode": "All"