0

Using Visual Studio 2017, sometimes new item templates are missing, and it seems to be tied to the particular project to which I'm trying to add an item.

Although both show up as "C#" projects... enter image description here ...in "Logging", for WPF items, I have only UserControl (WPF) as an option: Only UserControl is available

However, in "SanityCheck", I have a much-more-full list of WPF options: Many more WPF options available

The only difference I can easily see so far is that the one ("Logging") is a Class Library project while the other ("SanityCheck") is a Windows Application project. However, changing Logging to Windows Application doesn't make more options available, and I ought to be able to create a Window in a Class Library, right?

I also noticed that Logging didn't contain all the same references as SanityCheck, so I added all the ones that seemed possibly-related, and that also didn't make any difference in the set of templates available.

So how do I get my Logging project to let me add a WPF Window?

Brian A. Henning
  • 1,374
  • 9
  • 24
  • 1
    inspect (and compare) .csproj file. I expect there will be different blocks https://stackoverflow.com/questions/10802198/visual-studio-project-type-guids – ASh Jan 28 '21 at 18:20
  • Interesting. The "Logging" .csproj doesn't have a element at all. I'm going to try adding the same one from "SanityCheck" and see what happens... – Brian A. Henning Jan 29 '21 at 22:36
  • ...and that magically made all the other C# WPF options appear. Thanks for the tip! – Brian A. Henning Jan 29 '21 at 22:38

1 Answers1

0

Thanks to a comment from ASh and the list referred to from this question, I determined that the cause was a missing <ProjectTypeGuids> block in the Logging.csproj file. I copied the one from the SanityCheck.csproj file and now all the C# WPF templates are available. So far I haven't encountered any negative side-effects to this solution. Time will tell.

Brian A. Henning
  • 1,374
  • 9
  • 24