NuGet包在visual studio 2015和Xamarin中会引起问题

本文关键字:问题 Xamarin 包在 visual studio 2015 NuGet | 更新日期: 2023-09-27 18:13:22

我正在尝试使用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包在visual studio 2015和Xamarin中会引起问题

这个错误信息将会发生,因为您没有. NuGet 'NuGet。目标文件。

要修复它,您可以停止使用基于MSBuild的NuGet包恢复或添加. NuGet/NuGet。目标文件到源代码控制。

基于MSBuild的NuGet包恢复已被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包。