-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Provide ResolvedFrameworkReferences for VS to populate Solution Explorer #3355
Provide ResolvedFrameworkReferences for VS to populate Solution Explorer #3355
Conversation
/azp run |
Pull request contains merge conflicts. |
Add ResolveFrameworkReferences target, rename ResolveTargetingPacks to ResolveTargetingPackAssets
Test case where targeting packs need to be downloaded
5062acd
to
eebffb7
Compare
@drewnoakes @davkean Take a look at this PR and let me know if this matches what you were expecting based on our discussion. |
ResolvedTargetingPacks="@(ResolvedTargetingPack)" | ||
ResolvedRuntimePacks="@(ResolvedRuntimePack)"> | ||
|
||
<Output TaskParameter="ResolvedFrameworkReferences" ItemName="ResolvedFrameworkReference" /> |
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.
What metadata does this item have?
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.
Ah, its here: https://github.com/dotnet/sdk/pull/3355/files#diff-6cfbacaa410e7ee1787b4771b158ded0. It was collapsed.
Yes, this appears to be what we want. We'll also want a ResolveFrameworkReferences in MSBuild proper so that we can call regardless of we're an SDK project or not.
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.
Can you show me an example of one of these and we can decide what properties we want to show up?
to the assets file, and the ResolvePackageAssets target adds them to the TransitiveFrameworkReference | ||
item. Here, we add them to FrameworkReference if they aren't already referenced. | ||
============================================================ | ||
--> | ||
<Target Name="AddTransitiveFrameworkReferences" AfterTargets="ResolvePackageAssets" |
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.
Will these appear as "ResolvedFrameworkReference"?
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.
Would it be a problem if you end up with ResolvedFrameworkReference items that didn't have a corresponding FrameworkReference when you evaluated? Would you just ignore them or would it be a warning or error?
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.
We will ignore them.
This looks great to me. Seems the metadata on
I'm guessing we show all of these (maybe not The Dependencies node will also need |
Note that the runtime pack metadata won't be set unless the |
packagesToDownload.Add(packageToDownload); | ||
} | ||
} | ||
TaskItem resolvedFrameworkReference = new TaskItem(frameworkReference.ItemSpec); |
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.
We're expecting metadata (including IsImplicitlyDefined/PrivateAssets) to be copied from the original item -> resolved item, I think (?) this is what ResolveAssemblyReferences does.
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 would expect IsImplicitlyDefined to determine whether you can delete the reference from the solution tree, but what would you do with PrivateAssets?
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.
It shows up in the Properties page so that you can flip 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'm not sure I consider PrivateAssets on FrameworkReference items a user-facing feature. We use it to communicate that an implicit FrameworkReference is represented by the target framework, and thus doesn't need to flow transitively. I don't think there's a scenario for setting it on other FrameworkReferences, and if it shows up in the UI it's more likely to cause confusion and incorrect builds if people set 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.
You might have a reference to a project with a direct FrameworkReference and not want to inherit its FrameworkReference.
Currently assuming the properties are:
|
Can we have an example of these values? What exactly will TargetingPackName/Version give us that the path won't? |
I will get examples later, but the name and version will be elements of the path. So they are to some degree redundant. Also, just because we're setting a given piece of metadata on the ResolvedFrameworkReference items doesn't mean I think the value should necessarily be displayed. It just gives VS the flexibility to decide to display it if we think that's the right thing. |
Agree. It'd be useful to see examples of these values so we can decide whether to remove any of the above properties. |
…e Solution Explorer
…m in solution explorer tree
6e46e4d
to
c1a7da3
Compare
Here's an example of what the ResolvedFrameworkReference
Microsoft.NETCore.App
IsImplicitlyDefined = true
OriginalItemSpec = Microsoft.NETCore.App
Profile =
RuntimePackName = Microsoft.NETCore.App.Runtime.win-x86
RuntimePackPath = C:\Users\daplaist\.nuget\packages\microsoft.netcore.app.runtime.win-x86\3.0.0-preview7-27814-01
RuntimePackVersion = 3.0.0-preview7-27814-01
TargetingPackName = Microsoft.NETCore.App.Ref
TargetingPackPath = C:\git\dotnet-sdk\.dotnet\packs\Microsoft.NETCore.App.Ref\3.0.0-preview7-27814-01
TargetingPackVersion = 3.0.0-preview7-27814-01
Microsoft.AspNetCore.App
IsImplicitlyDefined =
OriginalItemSpec = Microsoft.AspNetCore.App
Profile =
RuntimePackName = Microsoft.AspNetCore.App.Runtime.win-x86
RuntimePackPath = C:\Users\daplaist\.nuget\packages\microsoft.aspnetcore.app.runtime.win-x86\3.0.0-preview7.19311.5
RuntimePackVersion = 3.0.0-preview7.19311.5
TargetingPackName = Microsoft.AspNetCore.App.Ref
TargetingPackPath = C:\git\dotnet-sdk\.dotnet\packs\Microsoft.AspNetCore.App.Ref\3.0.0-preview7.19311.5
TargetingPackVersion = 3.0.0-preview7.19311.5
Microsoft.WindowsDesktop.App
IsImplicitlyDefined =
OriginalItemSpec = Microsoft.WindowsDesktop.App
Profile =
RuntimePackName = Microsoft.WindowsDesktop.App.Runtime.win-x86
RuntimePackPath = C:\Users\daplaist\.nuget\packages\microsoft.windowsdesktop.app.runtime.win-x86\3.0.0-preview7-27814-01
RuntimePackVersion = 3.0.0-preview7-27814-01
TargetingPackName = Microsoft.WindowsDesktop.App.Ref
TargetingPackPath = C:\git\dotnet-sdk\.dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.0.0-preview7-27814-01
TargetingPackVersion = 3.0.0-preview7-27814-01 I'd suggest that the project system have a list of the metadata values to show, instead of a list that shouldn't be shown and showing everything else. |
That's exactly what happens: https://github.com/dotnet/project-system/pull/4928/files#diff-5060c4224c575eb7de55c6c2353a0ac8 Are we sure that |
They only show up in certain situations, so it would be confused as to when they are populated vs. not. |
Matches FrameworkReference items with KnownFrameworkReference items to determine the corresponding | ||
targeting pack and if necessary the runtime pack. If the packs aren't available in the NetCoreTargetingPackRoot | ||
folder, then generate PackageDownload items in order to download the packs during restore. | ||
|
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.
Thank you for adding these. :)
@@ -50,6 +50,7 @@ public void The_design_time_build_succeeds_before_nuget_restore(string relativeP | |||
var projectDirectory = Path.Combine(testAsset.TestRoot, relativeProjectPath); | |||
|
|||
var command = new MSBuildCommand(Log, "ResolveAssemblyReferencesDesignTime", projectDirectory); | |||
command.WorkingDirectory = projectDirectory; |
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.
What happened here?
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.
One of the args creates a binlog, so this ensures it goes to the right folder.
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.
That's not obvious. We should either make it so all tests can write binlogs or revert writing of binlog before committing. I don't want to see this spread.
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.
Also binlog writing is significantly slower and our tests are already slow.
resolvedFrameworkReference.SetMetadata("TargetingPackPath", targetingPack.GetMetadata(MetadataKeys.Path)); | ||
resolvedFrameworkReference.SetMetadata("TargetingPackName", targetingPack.GetMetadata(MetadataKeys.PackageName)); | ||
resolvedFrameworkReference.SetMetadata("TargetingPackVersion", targetingPack.GetMetadata(MetadataKeys.PackageVersion)); | ||
resolvedFrameworkReference.SetMetadata("Profile", targetingPack.GetMetadata("Profile")); |
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.
Naming nit: Should this be TargetingPackProfile?
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.
Thinking about it, I think it makes slightly more sense as Profile
than as TargetingPackProfile
.
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 don't have a strong opinion, but why? The Profile has no meaning at runtime.
…0191029.1 (dotnet#3355) - Microsoft.Build.Localization - 16.4.0-preview-19529-01 - Microsoft.Build - 16.4.0-preview-19529-01
No description provided.