Skip to content

Commit

Permalink
dotnet-svcutil: write referenced assembly name instead of absolute pa…
Browse files Browse the repository at this point in the history
…th to generated json file
  • Loading branch information
imcarolwang committed Apr 16, 2024
1 parent 03c88ea commit f70768c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/dotnet-svcutil/lib/src/CommandProcessorOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,12 @@ private async Task ProcessReferencesOptionAsync(CancellationToken cancellationTo
{
for (int idx = this.References.Count - 1; idx >= 0; idx--)
{
if (!references.Contains(this.References[idx]))
var selected = references.Where(x => this.References[idx].Name == x.Name).FirstOrDefault();
if (selected != null)
{
this.References[idx] = selected;
}
else
{
this.References.RemoveAt(idx);
}
Expand Down
10 changes: 10 additions & 0 deletions src/dotnet-svcutil/lib/src/Shared/Options/UpdateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ public void MakePathsRelativeTo(DirectoryInfo optionsFileDirectory)
this.Inputs[idx] = new Uri(relPath, UriKind.Relative);
}
}

//update referenced assembly path
for (int idx = 0; idx < this.References.Count; idx++)
{
var reference = this.References[idx];
if (reference.DependencyType.Equals(ProjectDependencyType.Binary))
{
this.References[idx] = ProjectDependency.FromAssembly(reference.AssemblyName);
}
}
}

public void ResolveFullPathsFrom(DirectoryInfo optionsFileDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"outputFile": "Reference.cs",
"references": [
"$TEMP$MultiTargetTypeReuse//TypeReuseClient//bin//Debug//net6.0//BinLib.dll"
"BinLib"
],
"targetFramework": "N.N",
"typeReuseMode": "All"
Expand Down

0 comments on commit f70768c

Please sign in to comment.