-
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
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.
doesn't it do both? 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. Yep! Fixed. That was a holdover from how I'd originally designed it. |
||
/// </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,13 @@ 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 => _unresolvedConflicts.ToArray(); | ||
|
||
#endregion | ||
#region Logging | ||
|
||
|
@@ -990,16 +1004,30 @@ quiet at the engine level. | |
// Log the reference which lost the conflict and the dependencies and source items which caused it. | ||
LogReferenceDependenciesAndSourceItemsToStringBuilder(fusionName, conflictCandidate, logDependencies.AppendLine()); | ||
|
||
string output = StringBuilderCache.GetStringAndRelease(logConflict); | ||
string details = string.Empty; | ||
if (logWarning) | ||
{ | ||
// This warning is logged regardless of AutoUnify since it means a conflict existed where the reference | ||
// chosen was not the conflict victor in a version comparison. In other words, the victor was older. | ||
Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.FoundConflicts", assemblyName.Name, StringBuilderCache.GetStringAndRelease(logConflict)); | ||
Log.LogWarningWithCodeFromResources("ResolveAssemblyReference.FoundConflicts", assemblyName.Name, output); | ||
} | ||
else | ||
{ | ||
Log.LogMessage(ChooseReferenceLoggingImportance(conflictCandidate), StringBuilderCache.GetStringAndRelease(logConflict)); | ||
Log.LogMessage(MessageImportance.Low, StringBuilderCache.GetStringAndRelease(logDependencies)); | ||
details = StringBuilderCache.GetStringAndRelease(logDependencies); | ||
Log.LogMessage(ChooseReferenceLoggingImportance(conflictCandidate), output); | ||
Log.LogMessage(MessageImportance.Low, details); | ||
} | ||
|
||
if (OutputUnresolvedAssemblyConflicts) | ||
{ | ||
_unresolvedConflicts.Add(new TaskItem(assemblyName.Name, new Dictionary<string, string>() | ||
{ | ||
{ "logMessage", output }, | ||
{ "logMessageDetails", details }, | ||
{ "victorVersionNumber", victor.ReferenceVersion.ToString() }, | ||
{ "victimVersionNumber", conflictCandidate.ReferenceVersion.ToString() } | ||
})); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we make this a theory and test what happens when the item has the
.dll
extension? @dsplaisted is there a concrete answer for including.dll
in the assembly name? Or did your comment, "possibly with .dll possibly not," refer to the fact thatassemblyName.Name
may not have the extension along with it?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.
I understood him to mean that the SDK can handle the output having the .dll extension or not having it—it's the same information, just presented slightly differently. Since I'm creating the item, and I went with no .dll extension, that shouldn't be an issue.
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.
I wasn't sure whether the assembly name processed by ResolveAssemblyReference would have the .dll extension on it. If it consistently does not have the extension, then I would leave it out. It's also theoretically possible to reference an .exe, I believe.
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.
The summary behind
assemblyName.Name
:Looks like the SDK will have to account for both scenarios, unless there's a preference on how we handle it here. I'm okay with either scenario.
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.
Sounds like MSBuild shouldn't do anything special here then (ie don't add the .dll extension).