简体   繁体   English

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

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

I'm trying to create an android application using Xamarin and Visual Studio 2015 with another friend with source control. 我正在尝试使用Xamarin和Visual Studio 2015与另一位拥有源代码控制权限的朋友创建一个Android应用程序。

Everything went fine until my friend added a project and he used NuGet packages. 一切都很顺利,直到我的朋友添加了一个项目并且他使用了NuGet包。

After I activated the get latest version and tried to build the solution I got the error message: 在我激活获取最新版本并尝试构建解决方案后,我收到了错误消息:

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

I looked up some solutions for this problem and tried to uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers packages and re installing them but it didn't help. 我查找了一些针对此问题的解决方案并尝试卸载Microsoft.CodeDom.Providers.DotNetCompilerPlatform和Microsoft.Net.Compilers包并重新安装它们但它没有帮助。 I don't even have a \\packages\\Microsoft.Net.Compilers.1.0.0\\build folder in my solution. 我的解决方案中甚至没有\\ packages \\ Microsoft.Net.Compilers.1.0.0 \\ build文件夹。

Everything in the NuGet package restore is already checked and I don't have any '.nuget' files in my solution. NuGet包还原中的所有内容都已经过检查,我的解决方案中没有任何“.nuget”文件。

What can I do to eliminate that error message? 我该怎么做才能消除该错误消息?

Thank you in advance! 先感谢您!

That error message will be occurring because you do not have the .nuget\\NuGet.targets file. 由于您没有.nuget \\ NuGet.targets文件,因此将出现该错误消息。

To fix it you could stop using the MSBuild based NuGet package restore or add the .nuget/NuGet.targets file to source control. 要修复它,您可以停止使用基于MSBuild的NuGet包还原或将.nuget / NuGet.targets文件添加到源代码管理。

The MSBuild based NuGet package restore is deprecated by the NuGet team. NuGet团队不推荐使用基于MSBuild的NuGet包还原。 It adds some extra elements to your project file (.csproj): 它为项目文件(.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')" />

You may have more items in the EnsureNuGetPackageBuildImports target element. 您可以在EnsureNuGetPackageBuildImports目标元素中包含更多项目。 You can remove these from the project file and instead rely on Visual Studio to restore the NuGet packages. 您可以从项目文件中删除它们,而是依赖Visual Studio来恢复NuGet包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio 2015更新3无法读取NuGet程序包 - Visual Studio 2015 update 3 cannot read NuGet package 无法在Visual Studio 2015 Web API项目中添加nuget程序包 - Can not add a nuget package in visual studio 2015 web api project Visual Studio 2015 - NuGet包删除所有项目引用 - Visual Studio 2015 - NuGet package removes all project references Xamarin无法在Visual Studio 2015中编译 - Xamarin not compiling in Visual Studio 2015 2015 visual studio Nuget程序包管理器不允许我保存新的程序包源,并且Nuget.Config无效的XML - 2015 visual studio Nuget package manager does not let me save new package sources and Nuget.Config is not valid XML Nuget 包未在 Visual Studio 中更新 - Nuget package not updating in Visual Studio 无法在nuget包管理器visual studio 2015上安装“Microsoft.AspNet.Razor 3.2.3” - Cannot install “Microsoft.AspNet.Razor 3.2.3” at the nuget package manager visual studio 2015 如何在Visual Studio 2015上使用NuGet Package Manager安装NUnit for C# - How to install NUnit for C# with NuGet Package Manager on Visual Studio 2015 在Visual Studio 2015中使用NuGet安装软件包后,无法在参考中找到Math.net - Cannot find Math.net in References after installing package with NuGet in Visual Studio 2015 如何在Xamarin Studio中添加nuget包 - How to add nuget package in Xamarin studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM