microsoft / WindowsAppSDK

The Windows App SDK empowers all Windows desktop apps with modern Windows UI, APIs, and platform features, including back-compat support, shipped via NuGet.
https://docs.microsoft.com/windows/apps/windows-app-sdk/
MIT License
3.75k stars 311 forks source link

WinAppSdk app templates should generate code following coding best practices #1823

Open ChrisGuzak opened 2 years ago

ChrisGuzak commented 2 years ago

Describe the bug

@angelazhangmsft updated the templates for the WinAppSDK samples in this PR. These types of changes should be made to the templates that generate the WinAppSdk Apps.

Steps to reproduce the bug

  1. in VS create a new WinAppSdk C++ app using the templates
  2. inspect the code

Expected behavior

expected: the code follows best practices, for example using

namespace winrt
{
    using namespace Microsoft::UI::Xaml;
}

instead of

using namespace winrt;
using namespace Microsoft::UI::Xaml;

Screenshots

No response

NuGet package version

No response

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

JaiganeshKumaran commented 2 years ago

I think using the winrt namespace is fine as long as the project only uses C++/WinRT and doesn't use C++/CX and/or WRL along with it.

ChrisGuzak commented 2 years ago

This is the recommended best practice that we want templates to follow.

bpulliam commented 1 year ago

@ChrisGuzak are there any remaining issues in the templates located in https://github.com/microsoft/WindowsAppSDK/tree/main/dev/VSIX?