簡體   English   中英

NuGet包在visual studio 2015和Xamarin中引起麻煩

[英]NuGet package causes trouble in visual studio 2015 and Xamarin

我正在嘗試使用Xamarin和Visual Studio 2015與另一位擁有源代碼控制權限的朋友創建一個Android應用程序。

一切都很順利,直到我的朋友添加了一個項目並且他使用了NuGet包。

在我激活獲取最新版本並嘗試構建解決方案后,我收到了錯誤消息:

Severity    Code    Description Project File    Line
Error       This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props.    iBuy.API    C:\Users\איציק\Source\Workspaces\iBuy\IBuy\iBuy.API\iBuy.API.csproj 164

我查找了一些針對此問題的解決方案並嘗試卸載Microsoft.CodeDom.Providers.DotNetCompilerPlatform和Microsoft.Net.Compilers包並重新安裝它們但它沒有幫助。 我的解決方案中甚至沒有\\ packages \\ Microsoft.Net.Compilers.1.0.0 \\ build文件夾。

NuGet包還原中的所有內容都已經過檢查,我的解決方案中沒有任何“.nuget”文件。

我該怎么做才能消除該錯誤消息?

先感謝您!

由於您沒有.nuget \\ NuGet.targets文件,因此將出現該錯誤消息。

要修復它,您可以停止使用基於MSBuild的NuGet包還原或將.nuget / NuGet.targets文件添加到源代碼管理。

NuGet團隊不推薦使用基於MSBuild的NuGet包還原。 它為項目文件(.csproj)添加了一些額外的元素:

<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  <PropertyGroup>
    <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
  </PropertyGroup>
   <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

您可以在EnsureNuGetPackageBuildImports目標元素中包含更多項目。 您可以從項目文件中刪除它們,而是依賴Visual Studio來恢復NuGet包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM