Skip to content
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

Fix issue where WinUI C# and C++ item templates are not appearing in WinUI projects #2599

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

japarson
Copy link
Contributor

@japarson japarson commented Jun 8, 2022

Problem

In a previous PR, I attempted to prevent the WinUI C# templates from appearing in projects unrelated to WinUI. To do so, I set the ShowByDefault property to false. When this property is false, the decision to show/hide the item templates falls to the AppliesTo and TemplateGroupID properties.

The C# templates currently hold the value CSharp + SharedAssetsProject. However, an examination of the capabilities for a WinUI project reveals that SharedAssetsProject is no longer present:
image

The C++ templates currently hold no value for AppliesTo and TemplateGroupID.

Solution

For the C# templates, we can adjust the value for AppliesTo to be CSharp + WindowsAppSdk.

For the C++ templates, we can add the property AppliesTo with value VisualC + WindowsAppSdk. We can also add the property TemplateGroupID with value WinRT-Native-UAP, which comes from this table (link):

image

C#

image

C++

image

Work Item

microsoft/microsoft-ui-xaml#7148

@ghost ghost added the needs-triage label Jun 8, 2022
@evelynwu-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@japarson japarson marked this pull request as ready for review June 9, 2022 21:43
Copy link
Contributor

@evelynwu-msft evelynwu-msft left a comment

Choose a reason for hiding this comment

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

:shipit:

@japarson japarson merged commit ea92f45 into main Jun 10, 2022
@japarson japarson deleted the dev/japarson/winui-item-templates branch June 10, 2022 18:00
@TRadigk
Copy link

TRadigk commented Jun 16, 2022

I think it broke again in Version 17.3.0 Preview 2.0

@evelynwu-msft
Copy link
Contributor

I think it broke again in Version 17.3.0 Preview 2.0

@TRadigk Could you explain what you mean? This fix hasn't been released yet so it shouldn't be possible for it to have regressed.

evelynwu-msft pushed a commit that referenced this pull request Jun 17, 2022
…ates

## Problem
In a [previous PR](#2289), I attempted to prevent the WinUI C# templates from appearing in projects unrelated to WinUI. To do so, I set the [ShowByDefault](https://docs.microsoft.com/en-us/visualstudio/extensibility/showbydefault-visual-studio-templates?view=vs-2022) property to `false`. When this property is `false`, the decision to show/hide the item templates falls to the [AppliesTo](https://docs.microsoft.com/en-us/visualstudio/extensibility/appliesto-element-visual-studio-templates?view=vs-2022) and [TemplateGroupID](https://docs.microsoft.com/en-us/visualstudio/extensibility/templategroupid-element-visual-studio-templates?view=vs-2022) properties.

The C# templates currently hold the value `CSharp + SharedAssetsProject`. However, an examination of the capabilities for a WinUI project reveals that `SharedAssetsProject` is no longer present:
![image](https://user-images.githubusercontent.com/59936622/172943854-a7d108ed-453e-4849-844e-170489d4fca7.png)

The C++ templates currently hold no value for `AppliesTo` and `TemplateGroupID`.

## Solution
For the C# templates, we can adjust the value for `AppliesTo` to be `CSharp + WindowsAppSdk`.

For the C++ templates, we can add the property `AppliesTo` with value `VisualC + WindowsAppSdk`. We can also add the property `TemplateGroupID` with value `WinRT-Native-UAP`, which comes from this table ([link](https://docs.microsoft.com/en-us/visualstudio/extensibility/templategroupid-element-visual-studio-templates?view=vs-2022)):

![image](https://user-images.githubusercontent.com/59936622/172949107-b4be14fc-33d1-466c-9227-2d9db61c1643.png)

## C#
![image](https://user-images.githubusercontent.com/59936622/172935775-e1120116-95bc-4f97-8034-53175686e3a3.png)

## C++
![image](https://user-images.githubusercontent.com/59936622/172939101-6b791b67-d51d-4ca0-acd5-6014474f03ca.png)

## Work Item
microsoft/microsoft-ui-xaml#7148

(cherry picked from commit ea92f45)
evelynwu-msft added a commit that referenced this pull request Jun 17, 2022
…ates (#2641)

## Problem
In a [previous PR](#2289), I attempted to prevent the WinUI C# templates from appearing in projects unrelated to WinUI. To do so, I set the [ShowByDefault](https://docs.microsoft.com/en-us/visualstudio/extensibility/showbydefault-visual-studio-templates?view=vs-2022) property to `false`. When this property is `false`, the decision to show/hide the item templates falls to the [AppliesTo](https://docs.microsoft.com/en-us/visualstudio/extensibility/appliesto-element-visual-studio-templates?view=vs-2022) and [TemplateGroupID](https://docs.microsoft.com/en-us/visualstudio/extensibility/templategroupid-element-visual-studio-templates?view=vs-2022) properties.

The C# templates currently hold the value `CSharp + SharedAssetsProject`. However, an examination of the capabilities for a WinUI project reveals that `SharedAssetsProject` is no longer present:
![image](https://user-images.githubusercontent.com/59936622/172943854-a7d108ed-453e-4849-844e-170489d4fca7.png)

The C++ templates currently hold no value for `AppliesTo` and `TemplateGroupID`.

## Solution
For the C# templates, we can adjust the value for `AppliesTo` to be `CSharp + WindowsAppSdk`.

For the C++ templates, we can add the property `AppliesTo` with value `VisualC + WindowsAppSdk`. We can also add the property `TemplateGroupID` with value `WinRT-Native-UAP`, which comes from this table ([link](https://docs.microsoft.com/en-us/visualstudio/extensibility/templategroupid-element-visual-studio-templates?view=vs-2022)):

![image](https://user-images.githubusercontent.com/59936622/172949107-b4be14fc-33d1-466c-9227-2d9db61c1643.png)

## C#
![image](https://user-images.githubusercontent.com/59936622/172935775-e1120116-95bc-4f97-8034-53175686e3a3.png)

## C++
![image](https://user-images.githubusercontent.com/59936622/172939101-6b791b67-d51d-4ca0-acd5-6014474f03ca.png)

## Work Item
microsoft/microsoft-ui-xaml#7148

(cherry picked from commit ea92f45)

Co-authored-by: James Parsons <japarson@microsoft.com>
@SunnieShine
Copy link

SunnieShine commented Jun 18, 2022

Could you explain what you mean? This fix hasn't been released yet so it shouldn't be possible for it to have regressed.

It seems that I have missed reading this important reply. Thanks for your patience.


The original reply:

@evelynwu-msft Hello. Sorry to disturb you.

I use VS 17.3 preview 2 but the same issue encountered.

Pictures:

Template missing:

image

The elementary WinUI VS extensions has been installed:

image

I use VS 17.3p2:

image

Templates has been successfully installed.

image

I don't think that the issue has been fixed in the current version. 😞

@TRadigk
Copy link

TRadigk commented Jun 19, 2022

I think it broke again in Version 17.3.0 Preview 2.0

@TRadigk Could you explain what you mean? This fix hasn't been released yet so it shouldn't be possible for it to have regressed.

Thanks for the information. I was quite certain I had no trouble working with the templates recently, thus assuming prior the latest VS preview update.
Do you know of any workaround, to get it working until the fix is released? Re-installing the extension doesn't do the trick. I am glad I can continue most of my tasks in VS 2022 non-preview, so I am rather curious than limited by VS 2022 preview.

@evelynwu-msft
Copy link
Contributor

@TRadigk This will be addressed in the upcoming servicing update for 1.1. Unfortunately, the only workaround until then is to install the WinAppSdk 1.0.4 extension (C# Visual Studio 2022 extension and C++ Visual Studio 2022 extension) and manually upgrade the package version when creating a new project (the package upgrade step can be skipped if you're working with an existing project).

@evelynwu-msft
Copy link
Contributor

@TRadigk My mistake, the servicing update with the fixed templates has already been released; updating your installed extension to 1.1.2 should resolve this problem for you: C# Visual Studio 2022 extension and C++ Visual Studio 2022 extension.

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.

None yet

5 participants