Skip to content

Commit 09b760f

Browse files
committed
cleaup
1 parent c5b09d5 commit 09b760f

58 files changed

Lines changed: 336 additions & 1330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/LegacyPackageReferenceProject.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ private async Task<PackageSpec> GetPackageSpecAsync(ISettings settings)
479479
FrameworkName = targetFramework,
480480
Warn = warn,
481481
PackagesToPrune = packagesToPrune,
482+
TargetAlias = targetFramework.ToString(),
482483
};
483484

484485
// Build up runtime information.

src/NuGet.Clients/NuGet.PackageManagement.VisualStudio/Projects/PackageReferenceProject.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ internal static Dictionary<string, TransitiveEntry> ComputeTransitivePackageOrig
383383
// For each target framework graph (Framework, RID)-pair:
384384
foreach (LockFileTarget targetFxGraph in targetsList)
385385
{
386-
var key = new FrameworkRuntimePair(targetFxGraph.TargetFramework, targetFxGraph.RuntimeIdentifier);
386+
var key = new FrameworkRuntimePair(targetFxGraph.TargetAlias, targetFxGraph.TargetFramework, targetFxGraph.RuntimeIdentifier);
387387

388388
foreach (var directPkg in installedPackages) // 3.1 For each direct dependency
389389
{

src/NuGet.Clients/NuGet.VisualStudio.Implementation/SolutionExplorer/Models/AssetsFileDependenciesSnapshot.cs

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ private AssetsFileDependenciesSnapshot(LockFile? lockFile, AssetsFileDependencie
9696
continue;
9797
}
9898

99-
string targetAlias = GetTargetAlias(lockFileTarget.Name);
99+
string targetAlias = lockFileTarget.TargetAlias;
100100

101101
previous.DataByTarget.TryGetValue(targetAlias, out AssetsFileTarget? previousTarget);
102102

103-
ImmutableArray<AssetsFileLogMessage> logMessages = ParseLogMessages(lockFile, previousTarget, lockFileTarget.Name);
103+
ImmutableArray<AssetsFileLogMessage> logMessages = ParseLogMessages(lockFile, previousTarget, targetAlias);
104104

105105
dataByTarget.Add(
106106
targetAlias,
@@ -114,34 +114,6 @@ private AssetsFileDependenciesSnapshot(LockFile? lockFile, AssetsFileDependencie
114114
DataByTarget = dataByTarget.ToImmutable();
115115
return;
116116

117-
string GetTargetAlias(string lockFileTargetName)
118-
{
119-
// In some places, the target alias specified in the project file (e.g. "net472") will not
120-
// match the target name used throughout the lock file (e.g. ".NETFramework,Version=v4.7.2").
121-
// The dependencies tree only uses the target alias (what's in the project file) so we need
122-
// to map back to that. See https://github.com/dotnet/project-system/issues/6832.
123-
124-
if (lockFile.PackageSpec.TargetFrameworks.Any(t => t.TargetAlias == lockFileTargetName))
125-
{
126-
// The target name used in the assets file matches the target alias in the project file.
127-
return lockFileTargetName;
128-
}
129-
130-
// The target name used in the assets file does NOT match any target alias in the project.
131-
// Attempt to find the name used in the project.
132-
foreach (TargetFrameworkInformation targetInfo in lockFile.PackageSpec.TargetFrameworks)
133-
{
134-
if (targetInfo.FrameworkName.DotNetFrameworkName == lockFileTargetName)
135-
{
136-
// We found a match, so return the alias.
137-
return targetInfo.TargetAlias;
138-
}
139-
}
140-
141-
// No match was found. Not ideal. Nothing to do but return the original value.
142-
return lockFileTargetName;
143-
}
144-
145117
static ImmutableArray<AssetsFileLogMessage> ParseLogMessages(LockFile lockFile, AssetsFileTarget? previousTarget, string target)
146118
{
147119
if (lockFile.LogMessages.Count == 0)

src/NuGet.Core/NuGet.Build.Tasks.Console/MSBuildStaticGraphRestore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ internal static List<TargetFrameworkInformation> GetTargetFrameworkInfos(IReadOn
752752
FrameworkReferences = GetFrameworkReferences(msBuildProjectInstance),
753753
PackagesToPrune = prunedReferences,
754754
RuntimeIdentifierGraphPath = msBuildProjectInstance.GetProperty(nameof(TargetFrameworkInformation.RuntimeIdentifierGraphPath)),
755-
TargetAlias = targetAlias,
755+
TargetAlias = string.IsNullOrEmpty(targetAlias) ? targetFramework.ToString() : targetAlias,
756756
Warn = warn
757757
};
758758

src/NuGet.Core/NuGet.Commands/GlobalSuppressions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@
110110
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'Task<IReadOnlyList<RestoreResultPair>> RestoreRunner.RunWithoutCommit(IEnumerable<RestoreSummaryRequest> restoreRequests, RestoreArgs restoreContext)', validate parameter 'restoreContext' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreRunner.RunWithoutCommit(System.Collections.Generic.IEnumerable{NuGet.Commands.RestoreSummaryRequest},NuGet.Commands.RestoreArgs)~System.Threading.Tasks.Task{System.Collections.Generic.IReadOnlyList{NuGet.Commands.RestoreResultPair}}")]
111111
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'RestoreSummary.RestoreSummary(RestoreResult result, string inputPath, IEnumerable<string> configFiles, IEnumerable<SourceRepository> sourceRepositories, IEnumerable<RestoreLogMessage> errors)', validate parameter 'result' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreSummary.#ctor(NuGet.Commands.RestoreResult,System.String,System.Collections.Generic.IEnumerable{System.String},System.Collections.Generic.IEnumerable{NuGet.Protocol.Core.Types.SourceRepository},System.Collections.Generic.IEnumerable{NuGet.Common.RestoreLogMessage})")]
112112
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'void RestoreSummary.Log(ILogger logger, IReadOnlyList<RestoreSummary> restoreSummaries, bool logErrors = false)', validate parameter 'logger' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreSummary.Log(NuGet.Common.ILogger,System.Collections.Generic.IReadOnlyList{NuGet.Commands.RestoreSummary},System.Boolean)")]
113-
[assembly: SuppressMessage("Build", "CA1801:Parameter log of method Create is never used. Remove the parameter or use it in the method body.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph,System.Collections.Generic.IEnumerable{NuGet.DependencyResolver.GraphNode{NuGet.DependencyResolver.RemoteResolveResult}},NuGet.DependencyResolver.RemoteWalkContext,NuGet.Common.ILogger,NuGet.Frameworks.NuGetFramework,System.String)~NuGet.Commands.RestoreTargetGraph")]
114-
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'RestoreTargetGraph RestoreTargetGraph.Create(RuntimeGraph runtimeGraph, IEnumerable<GraphNode<RemoteResolveResult>> graphs, RemoteWalkContext context, ILogger log, NuGetFramework framework, string runtimeIdentifier)', validate parameter 'graphs' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph,System.Collections.Generic.IEnumerable{NuGet.DependencyResolver.GraphNode{NuGet.DependencyResolver.RemoteResolveResult}},NuGet.DependencyResolver.RemoteWalkContext,NuGet.Common.ILogger,NuGet.Frameworks.NuGetFramework,System.String)~NuGet.Commands.RestoreTargetGraph")]
113+
[assembly: SuppressMessage("Build", "CA1801:Parameter log of method Create is never used. Remove the parameter or use it in the method body.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph,System.Collections.Generic.IEnumerable{NuGet.DependencyResolver.GraphNode{NuGet.DependencyResolver.RemoteResolveResult}},NuGet.DependencyResolver.RemoteWalkContext,NuGet.Common.ILogger,System.String,NuGet.Frameworks.NuGetFramework,System.String)~NuGet.Commands.RestoreTargetGraph")]
114+
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'RestoreTargetGraph RestoreTargetGraph.Create(RuntimeGraph runtimeGraph, IEnumerable<GraphNode<RemoteResolveResult>> graphs, RemoteWalkContext context, ILogger log, string targetAlias NuGetFramework framework, string runtimeIdentifier)', validate parameter 'graphs' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph,System.Collections.Generic.IEnumerable{NuGet.DependencyResolver.GraphNode{NuGet.DependencyResolver.RemoteResolveResult}},NuGet.DependencyResolver.RemoteWalkContext,NuGet.Common.ILogger,System.String,NuGet.Frameworks.NuGetFramework,System.String)~NuGet.Commands.RestoreTargetGraph")]
115115
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'Task<int> SignCommandRunner.ExecuteCommandAsync(SignArgs signArgs)', validate parameter 'signArgs' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.SignCommandRunner.ExecuteCommandAsync(NuGet.Commands.SignArgs)~System.Threading.Tasks.Task{System.Int32}")]
116116
[assembly: SuppressMessage("Build", "CA1062:In externally visible method 'Task<int> SignCommandRunner.ExecuteCommandAsync(IEnumerable<string> packagesToSign, SignPackageRequest signPackageRequest, string timestamper, ILogger logger, string outputDirectory, bool overwrite, CancellationToken token)', validate parameter 'packagesToSign' is non-null before using it. If appropriate, throw an ArgumentNullException when the argument is null or add a Code Contract precondition asserting non-null argument.", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.SignCommandRunner.ExecuteCommandAsync(System.Collections.Generic.IEnumerable{System.String},NuGet.Packaging.Signing.SignPackageRequest,System.String,NuGet.Common.ILogger,System.String,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Int32}")]
117117
[assembly: SuppressMessage("Build", "CA1822:Member ExecuteCommandAsync does not access instance data and can be marked as static (Shared in VisualBasic)", Justification = "<Pending>", Scope = "member", Target = "~M:NuGet.Commands.SignCommandRunner.ExecuteCommandAsync(System.Collections.Generic.IEnumerable{System.String},NuGet.Packaging.Signing.SignPackageRequest,System.String,NuGet.Common.ILogger,System.String,System.Boolean,System.Threading.CancellationToken)~System.Threading.Tasks.Task{System.Int32}")]

src/NuGet.Core/NuGet.Commands/PublicAPI/net472/PublicAPI.Shipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -976,8 +976,6 @@ static NuGet.Commands.ResolvedDependencyKey.operator ==(NuGet.Commands.ResolvedD
976976
~static NuGet.Commands.RestoreSpecException.Create(string message, System.Collections.Generic.IEnumerable<string> files) -> NuGet.Commands.RestoreSpecException
977977
~static NuGet.Commands.RestoreSpecException.Create(string message, System.Collections.Generic.IEnumerable<string> files, System.Exception innerException) -> NuGet.Commands.RestoreSpecException
978978
~static NuGet.Commands.RestoreSummary.Log(NuGet.Common.ILogger logger, System.Collections.Generic.IReadOnlyList<NuGet.Commands.RestoreSummary> restoreSummaries, bool logErrors = false) -> void
979-
~static NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph runtimeGraph, System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger log, NuGet.Frameworks.NuGetFramework framework, string runtimeIdentifier) -> NuGet.Commands.RestoreTargetGraph
980-
~static NuGet.Commands.RestoreTargetGraph.Create(System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger logger, NuGet.Frameworks.NuGetFramework framework) -> NuGet.Commands.RestoreTargetGraph
981979
~static NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(NuGet.ProjectModel.DependencyGraphSpec spec) -> void
982980
~static NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(NuGet.ProjectModel.DependencyGraphSpec spec, System.Collections.Generic.HashSet<string> projectsToSkip) -> void
983981
~static NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(NuGet.ProjectModel.DependencyGraphSpec spec, System.Collections.Generic.HashSet<string> projectsToSkip, NuGet.Common.ILogger logger) -> void

src/NuGet.Core/NuGet.Commands/PublicAPI/net472/PublicAPI.Unshipped.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ NuGet.Commands.Restore.ITargetFramework.GetItems(string! itemType) -> System.Col
1212
NuGet.Commands.Restore.ITargetFramework.GetProperty(string! propertyName) -> string!
1313
NuGet.Commands.Restore.Utility.PackageSpecFactory
1414
static NuGet.Commands.Restore.Utility.PackageSpecFactory.GetPackageSpec(NuGet.Commands.Restore.IProject! project, NuGet.Configuration.ISettings! settings) -> NuGet.ProjectModel.PackageSpec?
15+
~NuGet.Commands.IRestoreTargetGraph.TargetGraphNameWithAlias.get -> string
16+
~NuGet.Commands.RestoreTargetGraph.TargetAlias.get -> string
17+
~NuGet.Commands.RestoreTargetGraph.TargetGraphNameWithAlias.get -> string
1518
~static NuGet.Commands.MSBuildRestoreUtility.GetRestoreAuditProperties(NuGet.Commands.IMSBuildItem specItem, System.Collections.Generic.IEnumerable<NuGet.Commands.IMSBuildItem> allItems, System.Collections.Generic.HashSet<string> suppressionItems) -> NuGet.ProjectModel.RestoreAuditProperties
1619
~static NuGet.Commands.PushRunner.Run(NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.Collections.Generic.IList<string> packagePaths, string source, string apiKey, string symbolSource, string symbolApiKey, int timeoutSeconds, bool disableBuffering, bool noSymbols, bool noServiceEndpoint, bool skipDuplicate, bool allowInsecureConnections, NuGet.Common.ILogger logger) -> System.Threading.Tasks.Task
1720
~static NuGet.Commands.RestoreRunner.RunWithoutCommitAsync(System.Collections.Generic.IEnumerable<NuGet.Commands.RestoreSummaryRequest> restoreRequests, NuGet.Commands.RestoreArgs restoreContext, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<NuGet.Commands.RestoreResultPair>>
21+
~static NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph runtimeGraph, System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger log, string targetAlias, NuGet.Frameworks.NuGetFramework framework, string runtimeIdentifier) -> NuGet.Commands.RestoreTargetGraph
22+
~static NuGet.Commands.RestoreTargetGraph.Create(System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger logger, NuGet.Frameworks.NuGetFramework framework, string targetAlias) -> NuGet.Commands.RestoreTargetGraph

src/NuGet.Core/NuGet.Commands/PublicAPI/net8.0/PublicAPI.Shipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,8 +975,6 @@ static NuGet.Commands.ResolvedDependencyKey.operator ==(NuGet.Commands.ResolvedD
975975
~static NuGet.Commands.RestoreSpecException.Create(string message, System.Collections.Generic.IEnumerable<string> files) -> NuGet.Commands.RestoreSpecException
976976
~static NuGet.Commands.RestoreSpecException.Create(string message, System.Collections.Generic.IEnumerable<string> files, System.Exception innerException) -> NuGet.Commands.RestoreSpecException
977977
~static NuGet.Commands.RestoreSummary.Log(NuGet.Common.ILogger logger, System.Collections.Generic.IReadOnlyList<NuGet.Commands.RestoreSummary> restoreSummaries, bool logErrors = false) -> void
978-
~static NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph runtimeGraph, System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger log, NuGet.Frameworks.NuGetFramework framework, string runtimeIdentifier) -> NuGet.Commands.RestoreTargetGraph
979-
~static NuGet.Commands.RestoreTargetGraph.Create(System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger logger, NuGet.Frameworks.NuGetFramework framework) -> NuGet.Commands.RestoreTargetGraph
980978
~static NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(NuGet.ProjectModel.DependencyGraphSpec spec) -> void
981979
~static NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(NuGet.ProjectModel.DependencyGraphSpec spec, System.Collections.Generic.HashSet<string> projectsToSkip) -> void
982980
~static NuGet.Commands.SpecValidationUtility.ValidateDependencySpec(NuGet.ProjectModel.DependencyGraphSpec spec, System.Collections.Generic.HashSet<string> projectsToSkip, NuGet.Common.ILogger logger) -> void

src/NuGet.Core/NuGet.Commands/PublicAPI/net8.0/PublicAPI.Unshipped.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ NuGet.Commands.Restore.ITargetFramework.GetItems(string! itemType) -> System.Col
1212
NuGet.Commands.Restore.ITargetFramework.GetProperty(string! propertyName) -> string!
1313
NuGet.Commands.Restore.Utility.PackageSpecFactory
1414
static NuGet.Commands.Restore.Utility.PackageSpecFactory.GetPackageSpec(NuGet.Commands.Restore.IProject! project, NuGet.Configuration.ISettings! settings) -> NuGet.ProjectModel.PackageSpec?
15+
~NuGet.Commands.IRestoreTargetGraph.TargetGraphNameWithAlias.get -> string
16+
~NuGet.Commands.RestoreTargetGraph.TargetAlias.get -> string
17+
~NuGet.Commands.RestoreTargetGraph.TargetGraphNameWithAlias.get -> string
1518
~static NuGet.Commands.MSBuildRestoreUtility.GetRestoreAuditProperties(NuGet.Commands.IMSBuildItem specItem, System.Collections.Generic.IEnumerable<NuGet.Commands.IMSBuildItem> allItems, System.Collections.Generic.HashSet<string> suppressionItems) -> NuGet.ProjectModel.RestoreAuditProperties
1619
~static NuGet.Commands.PushRunner.Run(NuGet.Configuration.ISettings settings, NuGet.Configuration.IPackageSourceProvider sourceProvider, System.Collections.Generic.IList<string> packagePaths, string source, string apiKey, string symbolSource, string symbolApiKey, int timeoutSeconds, bool disableBuffering, bool noSymbols, bool noServiceEndpoint, bool skipDuplicate, bool allowInsecureConnections, NuGet.Common.ILogger logger) -> System.Threading.Tasks.Task
1720
~static NuGet.Commands.RestoreRunner.RunWithoutCommitAsync(System.Collections.Generic.IEnumerable<NuGet.Commands.RestoreSummaryRequest> restoreRequests, NuGet.Commands.RestoreArgs restoreContext, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<NuGet.Commands.RestoreResultPair>>
21+
~static NuGet.Commands.RestoreTargetGraph.Create(NuGet.RuntimeModel.RuntimeGraph runtimeGraph, System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger log, string targetAlias, NuGet.Frameworks.NuGetFramework framework, string runtimeIdentifier) -> NuGet.Commands.RestoreTargetGraph
22+
~static NuGet.Commands.RestoreTargetGraph.Create(System.Collections.Generic.IEnumerable<NuGet.DependencyResolver.GraphNode<NuGet.DependencyResolver.RemoteResolveResult>> graphs, NuGet.DependencyResolver.RemoteWalkContext context, NuGet.Common.ILogger logger, NuGet.Frameworks.NuGetFramework framework, string targetAlias) -> NuGet.Commands.RestoreTargetGraph

0 commit comments

Comments
 (0)