Skip to content

Commit

Permalink
update fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
imcarolwang committed Oct 18, 2024
1 parent 11e215c commit d1c3b3e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 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,17 @@ 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)
{
PathHelper.GetRelativePath(reference.FullPath, optionsFileDirectory, out relPath);
this.References[idx].ReferenceIdentity = relPath;
}
}
}

public void ResolveFullPathsFrom(DirectoryInfo optionsFileDirectory)
Expand All @@ -116,6 +127,16 @@ 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)
{
this.References[idx].FullPath = Path.Combine(optionsFileDirectory.FullName, reference.ReferenceIdentity);
}
}
}
}
}
6 changes: 3 additions & 3 deletions src/dotnet-svcutil/lib/src/Shared/ProjectDependency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal class ProjectDependency : IComparable<ProjectDependency>
/// <summary>
/// Assembly full path.
/// </summary>
public string FullPath { get; private set; }
public string FullPath { get; set; }

/// <summary>
/// Assembly name.
Expand All @@ -63,7 +63,7 @@ internal class ProjectDependency : IComparable<ProjectDependency>
/// <summary>
/// The package identity, used for describing the dependency passed to Svcutil.
/// </summary>
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.
Expand Down Expand Up @@ -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) :
string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.AssemblyName, this.Version);
FullPath;

this.IsFramework = this.Name == NetCoreAppPackageID || this.Name == NetStandardLibraryPackageID;
}
Expand Down

0 comments on commit d1c3b3e

Please sign in to comment.