Skip to content

Add proposal for supporting Reference items to assemblies in .NET Core targeting packs - #81

Closed
dsplaisted wants to merge 1 commit into
masterfrom
references-into-frameworkreferences
Closed

dsplaisted wants to merge 1 commit into
masterfrom
references-into-frameworkreferences

Conversation

@dsplaisted

Copy link
Copy Markdown
Member

This proposal is based on the discussion and proposed solution w.r.t. the WPF theme assemblies from here: dotnet/sdk#3265


WPF has several different theme assemblies, such as PresentationFramework.Aero and PresentationFramework.Luna. Each of these theme assemblies has types with the same name and namespace. This means that if you reference more than one of these assemblies, you need to do so with an assembly alias in order to distinguish between the types from the different assemblies in code.

With this proposal, we would not reference any of the theme assemblies by default. To use a single theme assembly, you would add a reference to it:

@vatsan-madhavan vatsan-madhavan Jun 24, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not referencing any of the theme assemblies is already the default - right? I would expect that with this proposal, the theme assemblies would become accessible.

If the change to remove theme assemblies from all profiles hasn't yet been made, then the current default is that all theme assemblies are referenced, and none are usable.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not yet removed the theme assemblies from being referenced by default.


### Conflict Resolution

Conflict resolution runs before ResolveAssemblyReference, however there may be conflicts involving references that will be resolved from a targeting pack by ResolveAssemblyReference. If there is a simple name reference to an assembly which is in multiple targeting packs, then ResolveAssemblyReference needs to pick the best one (using similar logic to conflict resolution). If there is a conflict between a simple name which will be resolved by ResolveAssemblyReference and another reference (either from a NuGet package or that has been resolved from a targeting pack already by ResolveTargetingPackAssets), then ResolvePackageFileConflicts needs to resolve the conflict. It already does something similar for .NET Framework, by reading the FrameworkList to get the version information that a reference will resolve to.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will conflict resolution handle ProjectReference vs. another reference correctly?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean if you're referencing a project that produces the same assembly that's in a targeting pack? If so, I wouldn't guarantee that conflict resolution will correctly handle that by default, as that should only happen for projects that are included in the targeting pack, which may have to add special case logic for this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's exactly what I mean. Microsoft.NetCore.App contains WindowsBase.dll, and if WPF repo tries to build PresentationFramework.csproj with a reference to WindowsBase.csproj, and a FrameworkReference to Microsoft.NetCore.App, will conflict resolution ensure that WindowsBase.csproj wins (alongwith the correct results in deps.json etc.)?

If that's not the case (I'm reasonably certain this doesn't work today - we have had to work aroudn this in WPF repos), can this scenario be fixed in conflict-resolution as part of this work?

@livarcocc

Copy link
Copy Markdown

cc @richlander @KathleenDollard

@vatsan-madhavan

Copy link
Copy Markdown
Member

fyi @rladuca, @ericstj

@vatsan-madhavan

Copy link
Copy Markdown
Member

fyi @merriemcgaw, @zsd4yr, @AdamYoblick


```xml
<FrameworkReference Update="Microsoft.WindowsDesktop.App" IncludeReferences="False" />
<Reference Include="System.Printing" />

@Nirmal4G Nirmal4G Jul 13, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also use it like this?

<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
<Reference Exclude="System.Printing">

OR

<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
<Reference Remove="System.Printing">

@terrajobst

Copy link
Copy Markdown
Contributor

@dsplaisted should this be merged or closed?

@dsplaisted

Copy link
Copy Markdown
Member Author

We ended up not needing this so we don't plan to do it at this time.

@dsplaisted dsplaisted closed this Mar 30, 2020
@jkotas
jkotas deleted the references-into-frameworkreferences branch April 29, 2020 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants