Skip to content

Commit f70768c

Browse files
committed
dotnet-svcutil: write referenced assembly name instead of absolute path to generated json file
1 parent 03c88ea commit f70768c

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/dotnet-svcutil/lib/src/CommandProcessorOptions.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,12 @@ private async Task ProcessReferencesOptionAsync(CancellationToken cancellationTo
627627
{
628628
for (int idx = this.References.Count - 1; idx >= 0; idx--)
629629
{
630-
if (!references.Contains(this.References[idx]))
630+
var selected = references.Where(x => this.References[idx].Name == x.Name).FirstOrDefault();
631+
if (selected != null)
632+
{
633+
this.References[idx] = selected;
634+
}
635+
else
631636
{
632637
this.References.RemoveAt(idx);
633638
}

src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ public void MakePathsRelativeTo(DirectoryInfo optionsFileDirectory)
9797
this.Inputs[idx] = new Uri(relPath, UriKind.Relative);
9898
}
9999
}
100+
101+
//update referenced assembly path
102+
for (int idx = 0; idx < this.References.Count; idx++)
103+
{
104+
var reference = this.References[idx];
105+
if (reference.DependencyType.Equals(ProjectDependencyType.Binary))
106+
{
107+
this.References[idx] = ProjectDependency.FromAssembly(reference.AssemblyName);
108+
}
109+
}
100110
}
101111

102112
public void ResolveFullPathsFrom(DirectoryInfo optionsFileDirectory)

src/dotnet-svcutil/lib/tests/Baselines/MultiTargetTypeReuse/TypeReuseClient/ServiceReference/dotnet-svcutil.params.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"outputFile": "Reference.cs",
1212
"references": [
13-
"$TEMP$MultiTargetTypeReuse//TypeReuseClient//bin//Debug//net6.0//BinLib.dll"
13+
"BinLib"
1414
],
1515
"targetFramework": "N.N",
1616
"typeReuseMode": "All"

0 commit comments

Comments
 (0)