[英]Can't create folder inside Shared project in Visual Studio 2017
[英]Why can't I create Shared Project in Visual Studio 2015?
我下載了 Visual Studio 社區 2015。我嘗試創建一個共享項目,但出現錯誤:
來自 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 的文件夾
一種解決方法是進行以下編輯:
打開文件%ProgramFiles(x86)%\\MSBuild\\Microsoft\\VisualStudio\\v14.0\\CodeSharing\\Microsoft.CodeSharing.CSharp.targets
(對於 Visual Basic,文件是Microsoft.CodeSharing.VisualBasic.targets
)並查找以下條目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')" />
將這些行更改為以下內容 -
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" Condition="false"/>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" Condition="true" />
基本上,撤消基於Xaml
的共享項目的條件導入。
這是(信不信由你)我從 MS 收到的關於這個問題的建議。 我認為這與將 RC(或更早)版本不干凈地升級到 RTM 以及在安裝過程中選擇不同的選項有關。
(插入關於編輯不“屬於”您的文件的常見警告,進行備份,如果您沒有信心進行此類編輯,請不要)
嘗試將 8.0 和 8.1 目錄從 C:\\Program Files (x86)\\MSBuild\\Microsoft\\WindowsXaml\\v12.0 復制到 C:\\Program Files (x86)\\MSBuild\\Microsoft\\WindowsXaml\\v14.0(注意版本號在結束)。
在 Windows 7 上的 2015 安裝中似乎缺少這些。
之后您需要重新啟動 Visual Studio。
要解決此問題,請安裝 Windows 8/8.1 項目模板。
我所做的只是:
這將啟動 Visual Studio 安裝程序,您可以在其中安裝缺少的模板。
然后你可以創建你的項目。
這不是一個困難的問題。 Kriper 先生(問題的原始提問者)可能使用他的 Visual Studio 2015 版本的“默認安裝”進行安裝。Kondrasovas 先生在答案 2 中指出需要安裝更多組件。 他的方法導致 Visual Studio 顯示設置實用程序錯誤,這不是 Kondrasovas 先生的錯。 如果您沒有遇到錯誤,Kondrasovas 先生的回答可能是正確的(我無法驗證答案)。
解決辦法是進入控制面板| 節目 | 卸載程序。 選擇 Visual Studio 2015 並“修改”已安裝的 Visual Studio 2015 實例:
[抱歉,我無法顯示圖像 b/c 我沒有 10 的聲譽,而 StackOverflow.com 阻止了我]
上一個(假想的)屏幕截圖來自 Visual Studio 2015 Professional 的默認安裝。 您可以四處亂搞並找出要安裝的確切功能,或者如果您有磁盤空間,只需單擊“全選”,然后單擊“下一步”。 提示:在對 Visual Studio 2015 的選定組件進行更改之前,不會啟用“下一步”按鈕。
如果您想查看完整的缺失圖像,我寫了一篇關於該問題的博客文章: http : //www.softwarepronto.com/2015/08/visual-studio-2015-error-adding-shared.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.