Why doesn't Visual Studio want me to add a new window to my WPF project?
Your project is probably configured as a WinForms project, or possibly as a class library. If it's created as either of these, you are only able to add a WPF UserControl, unfortunately.
Of course, there's no technical reason for this limitation, so you can copy/paste one from another project or recreate/change your project to be a WPF project.
I'm not sure what you change exactly to make it a WPF project in VS's eyes. You might try creating a new project and diffing it to your current project. You will most likely have to do some text editing on your .csproj
file.
Add this to your first <PropertyGroup>
element in your csproj:
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Here's an example:
<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{24793F93-0FD8-4EC9-B1D2-028DB489B10D}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>nest_spawner</RootNamespace> <AssemblyName>nest-spawner</AssemblyName> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup>
Becomes:
<?xml version="1.0" encoding="utf-8"?><Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{24793F93-0FD8-4EC9-B1D2-028DB489B10D}</ProjectGuid> <OutputType>WinExe</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>nest_spawner</RootNamespace> <AssemblyName>nest-spawner</AssemblyName> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> </PropertyGroup>
Try running devenv /installvstemplates
to reset your installed templates.I've used this before when the WPF User Control mysteriously disappeared from my add new list.
In my WPF project, when I click Add I get the following options (which includes Window).
So I'm afraid it's your setup.