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

WinUI 3 C# Window Templates are missing in Visual Studio 2022 17.2.2 in Add new item dialogue. #7148

Closed
1 of 2 tasks
engraneesahmad opened this issue May 26, 2022 · 39 comments
Labels
bug Something isn't working no-issue-activity team-Markup Issue for the Markup team

Comments

@engraneesahmad
Copy link

engraneesahmad commented May 26, 2022

Describe the bug

WinUI 3 C# Window Templates are missing in Visual Studio 2022 17.2.2 in Add new item dialogue.

Steps to reproduce the bug

WinUI 3 C# Window Templates are missing in Visual Studio 2022 17.2.2 in Add new item dialogue.

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.1 Preview 3: 1.1.0-preview3

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

Windows Insider Build (xxxxx)

Additional context

Windows 11 (21H2) Build 22621.1

@engraneesahmad engraneesahmad added the bug Something isn't working label May 26, 2022
@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label May 26, 2022
@kmgallahan
Copy link
Contributor

are missing in Visual Studio 2022 16.2.2

Visual Studio 2022 16.2.2 doesn't exist.

If you are using VS 2019 then they are installed via an extension:

https://docs.microsoft.com/en-us/windows/apps/windows-app-sdk/set-up-your-development-environment?tabs=vs-other%2Cvs-2019#visual-studio-project-and-item-templates

@engraneesahmad
Copy link
Author

engraneesahmad commented May 26, 2022 via email

@engraneesahmad engraneesahmad changed the title WinUI 3 C# Window Templates are missing in Visual Studio 2022 16.2.2 in Add new item dialogue. WinUI 3 C# Window Templates are missing in Visual Studio 2022 17.2.2 in Add new item dialogue. May 26, 2022
@kmgallahan
Copy link
Contributor

Try reinstalling the templates (or check that they are selected in the below bundle):

  1. Open Visual Studio Installer > Modify
  2. Uncheck .NET desktop development > Modify
  3. Check .NET desktop development > Modify

@engraneesahmad
Copy link
Author

engraneesahmad commented May 26, 2022 via email

@Pinox
Copy link

Pinox commented May 27, 2022

@engraneesahmad

Make sure sure you have the following installed on .net development & C++ desktop development.

image

image

I agree WinUI tooling from defaults are a mess, Not sure why the Windows App SDK is not selected by default.

Please MS fix this as it is wasting everyone's time !!

@engraneesahmad
Copy link
Author

Hi,
1
2
3
4
5

I have already installed these components.

The issue does not arise if i use Windows App SDK 1.0 in the stable release version templates display well.

But when i install Windows App SDK 1.1.0 Preview-3 for C# then templates miss in add new item dialogue.

I have carried out clean installation of Windows 11 (21H2) Build 22000 and clean installation of VS-2022 17.2.2 with the options shown in attached images on my home computer as well. The problem persists.

And I have carried out clean installation of Windows 11 (22H2) Build 22621.1 and clean installation of VS-2022 17.2.2 with the options shown in attached images on my laptop computer as well. The problem persists.

The problem arise due to VS-2022 17.2.2 and Windows App SDK 1.1.0 Preview-3....

Currently i am creating new xaml winui3 window manually (xaml files and xaml.cs file) and enterning into cs proj manually to workaround.

Resulting Dialogue box is also attached. I have to use Windows App SDK version 1.1.0 Preview-3 in order to use MICA Effect.
6

I have to use this functionality to build an application for chemical process design engineering field for my company. My time is also important. I am only started to report it to Microsoft so such problems will be eliminated in final release.

7

Otherwise i have to rewrite the app using .NET WPF because that does not waste time in such problems.

I can also share my project source code with microsoft if needed to resolve this issue.

@Pinox
Copy link

Pinox commented May 28, 2022

@engraneesahmad

Do u have .net 7 previews installed (SDK's) ? I had a similiar issue , can't remember anymore I think it was more MAUI related. Try unstalling all .net 7 preview if you have.

I will also install the C++ templates just to make sure. Your C++ is not selected as per your screen shot.
image

@engraneesahmad
Copy link
Author

engraneesahmad commented May 28, 2022 via email

@Pinox
Copy link

Pinox commented May 28, 2022

@engraneesahmad

Have you u tried installing VS 2022 on something like "Windows Sandbox" just to make sure it not something with you current PC installation.

image

@engraneesahmad
Copy link
Author

engraneesahmad commented May 28, 2022 via email

@Pinox
Copy link

Pinox commented May 28, 2022

OK I make virtual machine of windows 11 using VMWare then carry out clean installation then inform you. Give me some time…

I normally use Windows Sandbox, then there is no need to install Windows again. Also everything you install is only valid for the current session. Next start of sandbox and it empty again.

I guess it depends if you already have a virtual image ;))

@EddieLotter
Copy link

I updated VS 2022 Professional to 17.2.2 and now there is no template for ContentDialog.
This appears to have been an issue before.

@thilojaeggi
Copy link

Also facing the same issue. Manually installed Windows App SDK 1.1.0 Preview 3 C# Visual Studio 2022 extension to no avail.

@ojhad ojhad added the team-Markup Issue for the Markup team label Jun 2, 2022
@JonPerkinsOldGit
Copy link

I've spent five hours today on this issue - uninstalling Visual Studio, reinstalling, and so on. I've finally landed on this page and found it to be an issue that others have too. Would love to know if there is a better workaround than I am doing - copy and paste a different Page item and then rename the file and code name properties.

@marb2000
Copy link
Contributor

marb2000 commented Jun 3, 2022

[Edited given I mixed threads :)]

Sorry @JonPerkinsOldGit and @engraneesahmad, and others.

About the ContentDialog template, I believe we never added it to the WinAppSDK. It's the kind of thing we deprioritize against fixing bugs. It's not a big deal, and it's very convenient, but there is something else more important to do always. You know the feeling, right?

@Harrisandwich
Copy link

I am also having this issue. Installed VS2022 17.2.3 and Windows App SDK 1.1.0. Created two seperate WinUI projects. One using Template Studio and another just using the "Blank, Packaged) WinUI template in VS. Neither had WinUI file templates in the Add New Item dialog.

Currently attempting to unsintall VS2022 and reinstall it. Going to also try to install Windows App SDK v1.0.0 instead of v1.1.0 (@engraneesahmad mentioned that it worked fine for that version)

@matkovic
Copy link

matkovic commented Jun 8, 2022

Same problem here. I don't think I updated Visual Studio 2019 or project packages, but a couple of weeks ago I could see template items which are not listed there today (as I opened project again).

Could this have something to do with windows update?

@Harrisandwich
Copy link

An update on my situation if anyone here finds it helpful. I uninstalled all versions of visual studio on my machine (i had a couple), and reinstalled VS2022 with all of the options listed in the Tools for Windows App SDK page.

From there, I used Template Studio to create a new app. Everything seemed to work fine for that app. I was able to see a WinUI item templates ins in the Add Item dialog. I also made sure to confirm the installation of Windows App SDK through the Nuget package manager. Weirdly enough, the version was actually v1.1.0.

For this installation I did NOT use the extension found here. Perhaps using the extension was the issue? Seems a fresh install with just the workloads and components specified in the instructions worked. I think my issue was overall a result of misunderstanding/getting lost in the docs

@ghost1372
Copy link
Contributor

I also have this problem since the release of v1.1.0-preview3 extension. (i reinstalled windows and VS2022) I think this problem should be reported in Visual Studio team

@JonPerkinsOldGit
Copy link

From what I have found the WinUI templates are present if you run Visual Studio 17.3 preview 1. However, on this preview build you cannot [Project -> Publish -> Create App Package] so in that case you have to revert back to the latest VS 17.2. I'm managing OK now that I've figured that out.

Life at the leading edge eh? ;-)

@kmgallahan
Copy link
Contributor

After running into the issue mentioned here: microsoft/WindowsAppSDK#2579 and losing templates, updating to VS 2022 17.3.0 Preview 1.1 now shows the extensions as installed with templates working again:

Screenshot 2022-06-09 140334

@marb2000
Copy link
Contributor

Thanks, @japarson for the PR to fix the issue in Visual Studio

evelynwu-msft pushed a commit to microsoft/WindowsAppSDK that referenced this issue 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)
@JLBLU
Copy link

JLBLU commented Jun 17, 2022

Same issue in Version 17.3.0 Preview 2.0 / WindowsAppSDK 1.1.1

evelynwu-msft added a commit to microsoft/WindowsAppSDK that referenced this issue 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>
@pluto-dev
Copy link

Same issue in Version 17.3.0 Preview 2.0 / WindowsAppSDK 1.1.1

I can confirm this as well. Item templates are not available.

@tuffstuff9
Copy link

I am having the same issue. I have tried installing the experimental template extension but the install fails. I have also tried installing vs preview 2 and the templates still don't show up. What is the solution?

@kmgallahan
Copy link
Contributor

@tuffstuff9
Copy link

tuffstuff9 commented Jun 20, 2022

@pluto-dev @tuffstuff9 #7148 (comment)

Have tried that to no avail, unfortunately.

EDIT: I managed to get it working but I'm hoping an update comes out which fixes this for real. I went to Extensions > Manage Extensions > Installed, and found "Windows App SDK C# VS2022 Templates" and clicked revert. It reverted to version 1.0.3.xxx and is now working.

@s3nt1n3l-hub
Copy link

@pluto-dev @tuffstuff9 #7148 (comment)

Have tried that to no avail, unfortunately.

EDIT: I managed to get it working but I'm hoping an update comes out which fixes this for real. I went to Extensions > Manage Extensions > Installed, and found "Windows App SDK C# VS2022 Templates" and clicked revert. It reverted to version 1.0.3.xxx and is now working.

We're experiencing the same and have had to revert as above.

@ghost1372
Copy link
Contributor

In UWP Project, all items is available 😅

image

@mahfuzmr
Copy link

After running into the issue mentioned here: microsoft/WindowsAppSDK#2579 and losing templates, updating to VS 2022 17.3.0 Preview 1.1 now shows the extensions as installed with templates working again:

Screenshot 2022-06-09 140334

This Solved my Problem Also 👯‍♂️

@neos7m
Copy link

neos7m commented Jul 1, 2022

I am on 17.3 Preview 2 and the Revert button is not available. I only get Uninstall. I already tried uninstalling and reinstalling but nothing changed. I still don't have the templates.

@gabbybilka
Copy link
Member

Fixed with Windows App SDK 1.1.2, see release notes for more info.

cc: @evelynwu-msft

@ghost ghost added needs-triage Issue needs to be triaged by the area owners and removed needs-triage Issue needs to be triaged by the area owners labels Jul 5, 2022
@ArieBen
Copy link

ArieBen commented Jul 7, 2022

@gabbybilka Upgrading the nuget to Windows App SDK 1.1.2 in a new project doesn't cut it for me. I still can't see the Item templates.
How is this a fix? Can you be a bit more specific on how to implement? thx

@ghost1372
Copy link
Contributor

@gabbybilka Upgrading the nuget to Windows App SDK 1.1.2 in a new project doesn't cut it for me. I still can't see the Item templates. How is this a fix? Can you be a bit more specific on how to implement? thx

download new extension
https://aka.ms/windowsappsdk/1.1/1.1.2/vsix-2022-cs

@krschau krschau removed the needs-triage Issue needs to be triaged by the area owners label Jul 7, 2022
@kmgallahan
Copy link
Contributor

@ghost1372 Thanks.

@gabbybilka Item templates disappeared again for me. Neither updating to WASDK 1.1.2, updating to VS 17.3.0 Preview 3.0, or uninstalling/reinstalling the templates from the VS installer got them working.

Only installing the extension from the above link fixed the problem, and this requirement isn't mentioned anywhere in the docs or WASDK release notes as far as I can see.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Jul 15, 2022
@krschau krschau removed the needs-triage Issue needs to be triaged by the area owners label Jul 15, 2022
@Balkoth
Copy link

Balkoth commented Jul 26, 2022

Same problem here, only got it working after manually downloading from https://aka.ms/windowsappsdk/1.1/1.1.3/vsix-2022-cs and installing this version of the addon.

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Jul 26, 2022
@imsunburnt
Copy link

imsunburnt commented Sep 24, 2022

Just did reinstall of Visual Studio 2022 17.3.4 and C# UI templates are installed but do not show up in the Add New Item dialog. Same problem as others have mentioned. Manage Extensions screen shows Windows App SDK C# VS2022 Templates version 1.1.3.80461806 is installed. For UWP projects the UI templates are available. I had previously tried all the above recommendations but none worked. Still looking for solution.

Update:
Under Debug/Options/NuGet Package Manager/Package Sources -- I was missing entry for nuget.org so I added it (shown below). Under General I cleared NuGet caches first. This fixed the problem.

image

@engraneesahmad
Copy link
Author

engraneesahmad commented Oct 11, 2022 via email

@gabbybilka gabbybilka reopened this Nov 18, 2022
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-issue-activity team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests