为什么我不能在 Visual Studio 2015 中创建共享项目? [英] Why can't I create Shared Project in Visual Studio 2015?

查看:37
本文介绍了为什么我不能在 Visual Studio 2015 中创建共享项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载了 Visual Studio 社区 2015.我尝试创建一个共享项目,但出现错误:

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

来自 Microsoft.Windows.UI.Xaml.CSharp.targets 的内容

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>

我没有名称为 8.1 的文件夹

I do not have folder with name 8.1

推荐答案

一种解决方法是进行以下

One workaround is to make the following edits:

打开文件 %ProgramFiles(x86)%MSBuildMicrosoftVisualStudiov14.0CodeSharingMicrosoft.CodeSharing.CSharp.targets(对于 Visual Basic,文件是 Microsoft.CodeSharing.VisualBasic.targets) 并在第 8 行附近查找以下条目 -

Open the file %ProgramFiles(x86)%MSBuildMicrosoftVisualStudiov14.0CodeSharingMicrosoft.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)MicrosoftWindowsXamlv$(VisualStudioVersion)Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="Exists('$(MSBuildExtensionsPath32)MicrosoftWindowsXamlv$(VisualStudioVersion)Microsoft.Windows.UI.Xaml.CSharp.targets')"/>
<Import Project="$(MSBuildBinPath)Microsoft.CSharp.Targets" Condition="!Exists('$(MSBuildExtensionsPath32)MicrosoftWindowsXamlv$(VisualStudioVersion)Microsoft.Windows.UI.Xaml.CSharp.targets')" />    

将这些行更改为以下内容 -

Change these lines to the following -

<Import Project="$(MSBuildExtensionsPath32)MicrosoftWindowsXamlv$(VisualStudioVersion)Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="false"/>
<Import Project="$(MSBuildBinPath)Microsoft.CSharp.Targets" Condition="true" />

基本上,撤消基于 Xaml 的共享项目的条件导入.

Basically, undo the conditional import of the Xaml based shared projects.

这是(信不信由你)我从 MS 收到的关于这个问题的建议.我认为这与将 RC(或更早)版本不干净地升级到 RTM 以及安装过程中选择的不同选项有关.

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)

这篇关于为什么我不能在 Visual Studio 2015 中创建共享项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆