Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I create Shared Project in Visual Studio 2015?

I downloaded visual studio community 2015. I tried to create a Shared Project and am getting an error:

enter image description here

Content from Microsoft.Windows.UI.Xaml.CSharp.targets

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">     <PropertyGroup Condition="'$(TargetPlatformVersion)'==''">         <TargetPlatformVersion>8.0</TargetPlatformVersion>     </PropertyGroup>      <PropertyGroup Condition="'$(TargetPlatformIdentifier)' == 'UAP'">         <RedirectionTarget>8.2</RedirectionTarget>     </PropertyGroup>      <PropertyGroup Condition="'$(RedirectionTarget)' == ''">         <RedirectionTarget>$(TargetPlatformVersion)</RedirectionTarget>     </PropertyGroup>      <!-- Direct 8.0 projects to 8.1 targets to enable retargeting  -->     <PropertyGroup Condition="'$(RedirectionTarget)' == '8.0'">         <RedirectionTarget>8.1</RedirectionTarget>     </PropertyGroup>      <Import Project="$(RedirectionTarget)\Microsoft.Windows.UI.Xaml.CSharp.targets" /> </Project> 

I do not have folder with name 8.1

like image 362
kriper Avatar asked Jul 22 '15 14:07

kriper


People also ask

How do I create a shared project?

Creating a Shared Project To create a new Shared Project, navigate to File > New > Project. In Visual Studio 2019, enter shared in the search box on the Create a new project page. Select the Shared Project template and then select Next. Enter a name for the project, and then select Create.

What is shared project in Visual Studio?

Conceptually, you can think of Shared Projects as a container for Files. They show up as their own project in your solution in Fire or Visual Studio, and they can hold a bunch of files – usually source files, but they could also hold resources or other content. On their own, Shared Projects don't do much else.

How do I link a project in Visual Studio?

In Visual Studio 2019 version 16.8 and laterOn the start window, select Clone a repository. In the Browse a repository section, select Azure DevOps. If you see a sign-in window, sign in to your account. In the Connect to a Project dialog box, choose the repo that you want to connect to, and then select Clone.


2 Answers

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)

like image 64
Damien_The_Unbeliever Avatar answered Sep 19 '22 04:09

Damien_The_Unbeliever


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.

like image 34
Jarek Kardas Avatar answered Sep 23 '22 04:09

Jarek Kardas