gpt4 book ai didi

c# - NuGet 包导致 visual studio 2015 和 Xamarin 出现问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 19:18:26 26 4
gpt4 key购买 nike

我正尝试与另一个使用源代码控制的 friend 使用 Xamarin 和 Visual Studio 2015 创建一个 Android 应用程序。

一切都很顺利,直到我的 friend 添加了一个项目并且他使用了 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 文件添加到源代码管理。

基于 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 包。

关于c# - NuGet 包导致 visual studio 2015 和 Xamarin 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32667227/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com