-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Page automatically, remove from None automatically #685
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
Comments
My initial thought is that WinForms applications also reference the |
/cc @nguerrera, @ericstj, @dsplaisted, @merriemcgaw There are namespace overlaps between WPF & WinForms. Enabling both sets of references by default would likely cause some confusion (for both porting scenarios as well as new projects) rather than acting as a convenience. Why would you need |
WinForm applications likely wouldn't have .xaml files, though. So maybe As for adding |
I disagree, classic WinForms projects will default to compiling xaml as WPF In fact most of our projects are classic WinForms projects and still have WPF controls in them, works just fine. Whatever makes "WPF projects" special isn't needed in the classic project system. I don't see why that needs to change for .NET Core. That said I don't mind flipping on a "UseWPF" switch if its required to get things working, more of an annoyance than a roadblock. |
FYI @davkean |
@weltkante but then doesn't that mean that the WindowsDesktop SDK should put all .xaml files into a |
@heaths yes that's what happens in classic projects, you can add WPF Controls to WinForms apps without switching the project type or having to adjust build tags at all (only need to add references to the WPF framework assemblies if you don't have them, gets done automatically if you use the context menu to add a new WPF item from template instead of an existing from disk). I don't think its uncommon if you are gradually making use of WPF features in your WinForms application (instead of rewriting it from scratch in WPF only) Actually, do you manually reference framework assembly in .NET Core or does After considering that I still think I'd prefer a compile error when adding xaml to WinForms without having the right references, so I think they should always compiled as Page. If anything leave the automatic inclusion off for WinForms only apps (so it doesn't pick up xaml in the folder structure and I only get compile errors if I add it manually). Adding it as None for WinForms seems wrong to me because it is never useful. |
No, not specifying |
ok, I'm confused. Is the Issue about
What are the semantics of When a project implies |
@vatsan-madhavan I think what @heaths is referring to is the glob for |
@wjk - thanks for puzzling that out - very helpful! |
@heaths, we have talked about adding a suppressible warning when Don't have an issue tracking this yet, but I've come across several instances confusion - either missing Maybe we need two changes -
@nguerrera, thoughts? |
@dsplaisted @davkean are discussing related things. I'll defer to them on this. |
I was away on vacation, but like the idea of at least warning when using the |
Just out of my curiosity - I have so many console applications referencing WindowsBase/PresentationCore/PresentationFramework assemblies that I have a special project template for those. What is the expected set-up in .NET Core for equivalent apps? Does Second, as @weltkante noted, in .NET Framework, you can add User Control (WPF) item to pretty much any type of project including WinForms, and I remember being told that was on purpose for control developers. Are both |
What’s the distinction between these and a WPF app ? Is it just that these are marked as subsystem=console? |
Yeah, that sounds about right; and from compiler point of view, This wasn't meant to be a trick question, it's just that I can't really find any information on what |
@vatsan-madhavan The project system will stop adding a |
@dsplaisted Is there a reason that Page items are not excluded from None by default like the other item types? |
@davidwengier There is a filespec for inclusion into |
@vatsan-madhavan The question is why is it using |
We remove from We don't remove |
The problem is that VS needs to know how to modify the project to include a Page item, or change the build action of an item, etc. It can understand basic globs, but not arbitrarily complex expressions for items (such So today, if you add a new Page to a project, VS will add the following to your project:
|
Is being over-broad here really a problem? For example |
There is no clear benefit for WPF builds in modifying |
We're asking the reverse; we want the same model we have with all other built-in items as per @dsplaisted: #685 (comment) |
@vatsan-madhavan Changing the glob to |
OK, we can add that, only when we handle There will be situations (rare ones, I think) when we choose not to handle |
Yes, that makes sense to me. |
- #685: Remove **/*.xaml from None - #327: Cannot multi-target netcoreap < 3.0 and use WindowsDesktop SDK unconditionally. - #867: Show error when neither UseWpf nor UseWindowsForms is set to true - #746: [Epic] Support WPF and WinForms specific FrameworkReferences a Profiles Also cleans up the way in which we import Microsoft.WinFX.targets - UseLegacyPresentationBuildTasks has been broken for some time now and unusable.
- #685: Remove **/*.xaml from None - #327: Cannot multi-target netcoreap < 3.0 and use WindowsDesktop SDK unconditionally. - #867: Show error when neither UseWpf nor UseWindowsForms is set to true - #746: [Epic] Support WPF and WinForms specific FrameworkReferences a Profiles Also cleans up the way in which we import Microsoft.WinFX.targets - UseLegacyPresentationBuildTasks has been broken for some time now and unusable.
…eWinforms and multi-targeting experience (#1027) * Fixes the following: - #685: Remove **/*.xaml from None - #327: Cannot multi-target netcoreap < 3.0 and use WindowsDesktop SDK unconditionally. - #867: Show error when neither UseWpf nor UseWindowsForms is set to true - #746: [Epic] Support WPF and WinForms specific FrameworkReferences a Profiles Also cleans up the way in which we import Microsoft.WinFX.targets - UseLegacyPresentationBuildTasks has been broken for some time now and unusable.
@davkean, @davidwengier - just merged this fix. |
When the SDK is "Microsoft.NET.Sdk.WindowsDesktop", it would be nice not to have to add
<UseWPF>true</UseWPF>
. Especially when migrating projects from old-style .csproj files, this is easy to forget and seems otherwise unnecessary since I already claimed what project type I'm going to build. And wouldn't this be true of both WPF and UWP projects anyway - to include *.xaml files as<Page>
items?Also, why must the IDE - or, when using VSCode, we (manually) - add
<None Remove="..."/>
when the targets could do this for any<Page>
items. Could this also be done automatically in the targets for "Microsoft.NET.Sdk.WindowsDesktop"?This could make WPF SDK-style .csproj files as slim as non-WPF SDK-style .csproj files.
The text was updated successfully, but these errors were encountered: