-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally output unresolved assembly conflicts #5990
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -86,6 +86,7 @@ public ResolveAssemblyReference() | |||||||||||||||
private ITaskItem[] _scatterFiles = Array.Empty<TaskItem>(); | ||||||||||||||||
private ITaskItem[] _copyLocalFiles = Array.Empty<TaskItem>(); | ||||||||||||||||
private ITaskItem[] _suggestedRedirects = Array.Empty<TaskItem>(); | ||||||||||||||||
private List<ITaskItem> _unresolvedConflicts = new List<ITaskItem>(); | ||||||||||||||||
private string[] _targetFrameworkSubsets = Array.Empty<string>(); | ||||||||||||||||
private string[] _fullTargetFrameworkSubsetNames = Array.Empty<string>(); | ||||||||||||||||
private string _targetedFrameworkMoniker = String.Empty; | ||||||||||||||||
|
@@ -214,6 +215,12 @@ public bool IgnoreTargetFrameworkAttributeVersionMismatch | |||||||||||||||
/// </remarks> | ||||||||||||||||
public bool FindDependenciesOfExternallyResolvedReferences { get; set; } | ||||||||||||||||
|
||||||||||||||||
/// <summary> | ||||||||||||||||
/// If true, outputs any unresolved assembly conflicts (MSB3277) in UnresolvedAssemblyConflicts | ||||||||||||||||
/// instead of logging them. | ||||||||||||||||
/// </summary> | ||||||||||||||||
public bool OutputUnresolvedAssemblyConflicts { get; set; } | ||||||||||||||||
|
||||||||||||||||
/// <summary> | ||||||||||||||||
/// List of target framework subset names which will be searched for in the target framework directories | ||||||||||||||||
/// </summary> | ||||||||||||||||
|
@@ -915,6 +922,18 @@ public String DependsOnNETStandard | |||||||||||||||
private set; | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
/// <summary> | ||||||||||||||||
/// If OutputUnresolvedAssemblyConflicts then a list of information about unresolved conflicts that normally would have | ||||||||||||||||
/// been outputted in MSB3277. Otherwise empty. | ||||||||||||||||
/// </summary> | ||||||||||||||||
[Output] | ||||||||||||||||
public ITaskItem[] UnresolvedAssemblyConflicts { | ||||||||||||||||
get | ||||||||||||||||
{ | ||||||||||||||||
return _unresolvedConflicts.ToArray(); | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
|
||||||||||||||||
|
||||||||||||||||
#endregion | ||||||||||||||||
#region Logging | ||||||||||||||||
|
||||||||||||||||
|
@@ -1001,6 +1020,11 @@ quiet at the engine level. | |||||||||||||||
Log.LogMessage(ChooseReferenceLoggingImportance(conflictCandidate), StringBuilderCache.GetStringAndRelease(logConflict)); | ||||||||||||||||
Log.LogMessage(MessageImportance.Low, StringBuilderCache.GetStringAndRelease(logDependencies)); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if (OutputUnresolvedAssemblyConflicts) | ||||||||||||||||
{ | ||||||||||||||||
_unresolvedConflicts.Add(new TaskItem(assemblyName.Name)); | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would include the log message with the human-readable details in the metadata for this item. We don't currently have a use case for programmatically processing data such as conflicting version numbers, how the assembly was referenced, etc. I would say if it's straightforward to include, then go ahead and do so. But if not, then skip it for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Conflicting version numbers is easy, so I included that. How it's referenced is doable, but it's a little verbose, since there could be multiple levels of dependencies (A depends on B depends on C depends on D depends on the conflicting dll). I can add it later if we decide we need it, though. |
||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2156,6 +2156,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
<ResolveAssemblyReferencesFindRelatedSatellites Condition="'$(ResolveAssemblyReferencesFindRelatedSatellites)' == ''">$(BuildingProject)</ResolveAssemblyReferencesFindRelatedSatellites> | ||
<ResolveAssemblyReferencesFindSerializationAssemblies Condition="'$(ResolveAssemblyReferencesFindSerializationAssemblies)' == ''">$(BuildingProject)</ResolveAssemblyReferencesFindSerializationAssemblies> | ||
<ResolveAssemblyReferencesFindRelatedFiles Condition="'$(ResolveAssemblyReferencesFindRelatedFiles)' == ''">$(BuildingProject)</ResolveAssemblyReferencesFindRelatedFiles> | ||
<ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts Condition="'$(ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts)' == ''">false</ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
|
@@ -2218,6 +2219,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
IgnoreTargetFrameworkAttributeVersionMismatch ="$(ResolveAssemblyReferenceIgnoreTargetFrameworkAttributeVersionMismatch)" | ||
FindDependenciesOfExternallyResolvedReferences="$(FindDependenciesOfExternallyResolvedReferences)" | ||
ContinueOnError="$(ContinueOnError)" | ||
OutputUnresolvedAssemblyConflicts="$(ResolveAssemblyReferenceOutputUnresolvedAssemblyConflicts)" | ||
Condition="'@(Reference)'!='' or '@(_ResolvedProjectReferencePaths)'!='' or '@(_ExplicitReference)' != ''" | ||
> | ||
|
||
|
@@ -2233,6 +2235,7 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |
<Output TaskParameter="FilesWritten" ItemName="FileWrites"/> | ||
<Output TaskParameter="DependsOnSystemRuntime" PropertyName="DependsOnSystemRuntime"/> | ||
<Output TaskParameter="DependsOnNETStandard" PropertyName="_DependsOnNETStandard"/> | ||
<Output TaskParameter="UnresolvedAssemblyConflicts" ItemName="UnresolvedAssemblyConflicts"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to use a name that's more likely to be unique. Similar to the pattern for the input property, that could be |
||
</ResolveAssemblyReference> | ||
</Target> | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't it do both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! Fixed. That was a holdover from how I'd originally designed it.