The imported project "C:Program Files(x86)MsBuildMicrosoftWindowsXamlv14.08.1Microsoft.Windows.UI.Xaml.CSharp.targets" was not found

While trying to create any C# shared or Windows Phone projects using the Visual Studio 2015 IDE, you may receive an error message as highlighted below:

1

2

This is a known issue and it would be fixed in a future update. In order to resolve the issue, please follow the below two workaround:

Workaround 1: Please modify the CodeSharing targets. To do so, download the attached target file and replace the file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeSharing\Microsoft.CodeSharing.CSharp.targets" with it.

Alternatively, you can repair the target file manually:
Open the file C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\CodeSharing\Microsoft.CodeSharing.CSharp.targets(or, for Visual Basic, Microsoft.CodeSharing.VisualBasic.targets)

Around line 8, you should see two entries:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets')"/>

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" Condition="!Exists('$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets')" />
 
Replace these entries with the following:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="false"/>

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" Condition="true" />

Workaround 2:
1. Open the VS 2015 IDE
2. Click on File->New->Project
3. Choose the only Project template under Windows 8 (below screenshot)
This will launch Visual Studio setup where you can install the templates that are missing.

3

4

5

Alternatively, you can install the below feature by changing the installed Visual Studio 2015 from the “Control Panel\Programs\Programs and Features”:

6

P.S.  For Windows 7 OS, the workaround 1 will be applicable only. It can also occur with Visual Basic shared projects. Obviously the file to modify would be the VB one (Microsoft.CodeSharing.VisualBasic.targets)

Microsoft.CodeSharing.CSharp.targets