Why can't I create Shared Project in Visual Studio 2015?
One workaround is to make the following edits:
Open the file %ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v14.0\CodeSharing\Microsoft.CodeSharing.CSharp.targets
(for Visual Basic the file is Microsoft.CodeSharing.VisualBasic.targets
) and look for the following entries around line 8 -
<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')" />
Change these lines to 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" />
Basically, undo the conditional import of the Xaml
based shared projects.
This is (believe it or not) the advice I received from MS for this issue. I think it's related to an unclean upgrade of the RC (or earlier) versions to RTM and the selection of different options during install.
(Insert usual caveats about editing files that don't "belong" to you, take backups, and if you're not confident to make such edits, don't)
Try to copy 8.0 and 8.1 directories from C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v12.0 to C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v14.0 (notice version number at the end).
It seems that those are missing in 2015 installation on windows 7.
You'll need to restart Visual Studio after that.
To fix this issue install the Windows 8/8.1 Project templates.
All I did was:
- Open VS 2015
- Click File->New->Project
- Choose the only Project template under Windows 8
This will launch Visual Studio setup where you can install the templates that are missing.
Then you can create your Project.