Saturday, August 22, 2015

Visual Studio 2015: Error Adding "Shared Project" to Solution

This entry presents an error I encountered and how I solved it.

My standard development Virtual Machine (as of August 2015) is Windows 10 Enterprise and Visual Studio 2015 Professional. As part of a desktop project (a solution containing a WPF project), I attempted to add a project of type "Shared Project" and received the following error dialog:

The text of the error is as follows:
The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\8.1\Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0\Microsoft.Windows.UI.Xaml.CSharp.targets

Notie the 8.1 in the previous path meaning Visual Studio 2015 is categorizing the Shared Project as Windows 8.1.

I found a article that pointed to the following as a way to solve the problem and it looked promising: Why can't I create Shared Project in Visual Studio 2015? and the answer that caught my attention is as follows:

To clarify what Mr. Kondrasovas is recommending, look at the following example found under the New Project dialog (from Visual Studio, File | New | Project) under Templates | Visual C# | Windows | Windows 8:

In a perfect world where developers "grow apple trees and honey bees and snow-white turtle doves" this would have solved the problem by on my machine the following error was displayed:

Then I thought back to the Visual Studio 2015 install process. I had selected the default instalation. There must be a set of Windows 8.1 categorized objects that did not install.

I was coding a desktop application that could run on Windows 8.1 or Windows 10. There was nothing that tied my project to only run on Windows 8.1. So Microsoft's categorization is odd.

So under Control Panel | Programs | Uninstall a program, I selected Visual Studio 2015. Most savvy Windows users realize to add features to a previously installed program to select "Uninstall a program" in order to display the "Uninstall or change a program" dialog as follows:

Clicking on "Microsoft Visual Studio Professional" display the following dialog:

To add the missing project templates, select "Modify" which displays:

Rather than guess at what items to check to remedy the situation, I clicked on "Select All":

Since the whole nine yards was selected, I clicked on Next:

After this I was able to create and add a Shared Project to a solution.

Revisiting the "New Project" dialog (from Visual Studio, File | New | Project) under Templates | Visual C# | Windows | Windows 8 the following is now displayed (not the missing templates have been installed):

The irony is that Shared Project template is not event listed as a Windows 8 template. The Shared Project template is founder under Templates | Visual C# | Windows:

No comments :

Post a Comment