【问题标题】:Complaining about not having enabled package restore for Nuget, even though it is the case抱怨没有为 Nuget 启用包还原,即使是这样
【发布时间】:2014-07-21 06:26:45
【问题描述】:

我有一个解决方案,其中一个项目一直给我这个问题:

此项目引用了此项目中缺少的 NuGet 包 电脑。启用 NuGet 包还原以下载它们。更多 信息,请参阅http://go.microsoft.com/fwlink/?LinkID=317567

问题与this 基本相同,我在其中启用了包还原,但我一直遇到问题。我尝试删除 .nuget 文件夹、清理缓存、删除包、清理解决方案并重建,但没有任何帮助。

执行我刚才描述的步骤时,我可以看到我将包下载到包文件夹中,但显然一个项目仍然存在问题。我似乎也看不到项目中缺少任何引用。

我使用的是 Visual Studio 2012 update 4,而 Nuget 是最新版本 (2.8.5)。

【问题讨论】:

    标签: visual-studio-2012 nuget


    【解决方案1】:

    我会使用文本编辑器查看您的项目文件 (.csproj)。我的猜测是,您不再使用的旧 NuGet 包引用了一个 MSBuild 目标。

    在下面的示例中,取自项目文件,如果安装了不同版本的 Xamarin.Forms,而不是 1.0.6188,即使还原所有 NuGet 包,您也会看到类似的错误。出现该消息是因为条件检查了自定义 MSBuild 目标文件是否存在,如果缺少,则会显示错误。

    <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('..\..\packages\Xamarin.Forms.1.0.6188\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Xamarin.Forms.1.0.6188\build\portable-win+net45+wp80+MonoAndroid10+MonoTouch10\Xamarin.Forms.targets'))" /> </Target>

    【讨论】:

    • 谢谢,这是需要的 bcl 文件,但我没有为它加载 nuget 数据包。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2012-05-07
    • 2018-07-31
    • 1970-01-01
    • 1970-01-01
    • 2013-05-13
    • 2018-11-17
    • 2013-06-13
    • 2020-02-04
    相关资源
    最近更新 更多