-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support WPF and WindowsForms-specific FrameworkReferences via profiles #3259
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
Support WPF and WindowsForms-specific FrameworkReferences via profiles #3259
Conversation
@miguep, Can you outline the problem with namespace/type collisions you encountered today because we now have references to all theme assemblies at the same time, which IIRC you had described as unavoidable and required a hacky target to remove some of them from the reference list? /cc @rladuca |
@vatsan-madhavan The problem I found is this: This happens because WindowsDesktop brings in all the theme assemblies references, where in .NET Framework you would explicitly reference which assembly you wanted, and attempting to reference more than one and using this type resulted in the same error |
@dsplaisted, How do we propose we handle these theme assembly conflicts? |
Are the theme assemblies designed to always be mutually exclusive? Are there scenarios where you need to alias and use more than one in the same project. I suppose we would have to put these into separate profiles to go with current design, but this is really not a pattern we anticipated. It is against the framework design guidelines to have types with same full name in the framework. :( |
I am surprised this hasn't been reported to us until now. Is the usual pattern to not reference these in user code at all? |
They are typically not referenced - they are used as a source of resources in That said, they can be referenced - naturally only one at a time (or more than one at a time with the help of namespace aliasing). We would have to support both patterns, I think. == This is what I think we should do: The default - not reference any of them. Put each of them in a separate newly added And also provide a mechanism for enabling |
We've had instances where developers reference the themes directly in order to force certain appearances in controls. A specific instance I recall is forcing Aero themed scrollbar chrome. Do we need to use |
@vatsan-madhavan My 2¢: While I don't really like your idea of having one theme DLL per framework reference (it's a bit too fine-grained for my taste), I do like the resulting ability to build more fine-grained theming support. (Once .NET Core 3.0 is out the door and behavior-changing PRs are ready to be considered, I — and undoubtedly others — will be all over fixing up the default WPF themes to not look nearly as ugly.) I would also appreciate a mechanism where a default theme can be selected automatically. Although Hope this helps! |
I suggest opening a tracking issue for the theme dlls. This change doesn't make the existing problem any worse so I think we should move forward with it (after code review of course, which I'm doing now.) |
} | ||
} | ||
|
||
ReferencesToAdd = deduplicatedReferences.Distinct() .ToArray(); |
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.
Why are we calling Distnct() if we've already removed dupes?
|
||
// Filter out duplicate references (which can happen when referencing two different profiles that overlap) | ||
List<TaskItem> deduplicatedReferences = DeduplicateItems(referencesToAdd); | ||
ReferencesToAdd = deduplicatedReferences.Distinct() .ToArray(); |
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.
Distinct is still there?
What are our expectation for the docs pertaining to the use of |
* Update dependencies from https://github.com/aspnet/websdk build 20191021.3 - Microsoft.NET.Sdk.Web - 3.1.100-preview2.19521.3 * Update dependencies from https://github.com/aspnet/websdk build 20191022.3 - Microsoft.NET.Sdk.Web - 3.1.100-preview2.19522.3
This PR supports referencing only Windows Forms or only WPF assets from the WindowsDesktop targeting pack. See https://github.com/dotnet/cli/issues/10536.
This is done by supporting the following additional FrameworkReferences:
In the implementation, a KnownFrameworkReference can specify a Profile of the targeting pack via metadata. https://github.com/dotnet/core-setup/issues/6210 tracks adding this information to the WindowsDesktop FrameworkList.xml. Until then, this PR hard-codes the assemblies which are in each profile.
After this is merged, the WindowsDesktop SDK should be updated to use the .WindowsForms or .WPF FrameworkReference depending on if the
UseWPF
orUseWindowsForms
properties are set. If both of them are set, it should use the base Microsoft.WindomwsDesktop.App FrameworkReference, which will include the integration DLL.@nguerrera @vatsan-madhavan