-
Notifications
You must be signed in to change notification settings - Fork 320
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
[release/1.4-stable] Various fixes for C++ project and item templates (#3745) #3754
[release/1.4-stable] Various fixes for C++ project and item templates (#3745) #3754
Conversation
This is a partial adoption of #3619 by @JaiganeshKumaran in order to expedite the merging of the changes from that PR which do not need additional time for discussion. The individual changes that were extracted from the aforementioned PR are as follows: - Removed usage of InitializeComponent as it's no longer recommended by C++/WinRT (see https://github.com/microsoft/cppwinrt/tree/master/nuget#initializecomponent for more details). - Removed Microsoft copyright notice. - Removed #include XAML headers in a template control header. This was in the C++/WinRT templates because a runtime component will not include XAML headers in pch.h, which is no longer the case with a WinUI 3 runtime component. - Made the WinUI 3 runtime component "desktop-only" as WinUI 3 cannot be used by UWP apps. This is a fix for #1780. (Note that unlike the original PR the source directory structure is not being changed in order to minimize potential merge conflicts.) - Removed App.idl because it's empty and not needed. - Indented App.xaml.cpp's content inside the implementation namespace, rather than `using namespace` for consistency with the rest of the code. Also removed `using namespace` for namespaces that aren't actually used (Controls and Navigation namespaces were needed for Frame navigation, which isn't performed in the WinUI 3 template. IInspectable is available as an alias in every WinRT implementation type, thus doesn't require prefixing it with Windows::Foundation). Additionally, this PR replaces `<ProjectTypeTag>uwp</ProjectTypeTag>` with `<ProjectTypeTag>WinUI</ProjectTypeTag>` (or just adds the latter if the former was not present at all) in the item templates. I don't believe this tag is surfaced anywhere in the Visual Studio UI but the consistency makes me happier. --------- Co-authored-by: Jaiganésh Kumaran <jaiganesh.kumaran@outlook.com> (cherry picked from commit 18ada2f)
/azp run |
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
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.
#pragma once | ||
#include <windows.h> |
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.
#include <winrt/Microsoft.UI.Xaml.Navigation.h> | ||
#include <winrt/Microsoft.UI.Xaml.Shapes.h> | ||
#include <winrt/Microsoft.UI.Dispatching.h> | ||
#include <wil/cppwinrt_helpers.h> |
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.
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.
No. That header file's sole purpose is to support async calls (WIL is where resume_foreground
ended up landing). More generally, I recall there was resistance in the past to the project templates automatically opting in developers to using WIL which is why we limit our usage to that one header file. If the functionality hadn't ended up in WIL then we wouldn't even have a Nuget package reference to it in the first place.
#include <winrt/Microsoft.UI.Xaml.Navigation.h> | ||
#include <winrt/Microsoft.UI.Xaml.Shapes.h> | ||
#include <winrt/Microsoft.UI.Dispatching.h> | ||
#include <wil/cppwinrt_helpers.h> |
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.
This is a partial adoption of #3619 by @JaiganeshKumaran in order to expedite the merging of the changes from that PR which do not need additional time for discussion. The individual changes that were extracted from the aforementioned PR are as follows:
using namespace
for consistency with the rest of the code. Also removedusing namespace
for namespaces that aren't actually used (Controls and Navigation namespaces were needed for Frame navigation, which isn't performed in the WinUI 3 template. IInspectable is available as an alias in every WinRT implementation type, thus doesn't require prefixing it with Windows::Foundation).Additionally, this PR replaces
<ProjectTypeTag>uwp</ProjectTypeTag>
with<ProjectTypeTag>WinUI</ProjectTypeTag>
(or just adds the latter if the former was not present at all) in the item templates. I don't believe this tag is surfaced anywhere in the Visual Studio UI but the consistency makes me happier.Co-authored-by: Jaiganésh Kumaran jaiganesh.kumaran@outlook.com
(cherry picked from commit 18ada2f)