【问题标题】:What is the EnsureNuGetPackageBuildImports target?EnsureNuGetPackageBuildImports 目标是什么?
【发布时间】:2014-04-01 03:43:46
【问题描述】:

在我的一些 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>

这到底是什么,我为什么需要它?我的其他项目正在恢复他们的包,没有它

我正在使用 VS2013 和 NuGet 2.8。

【问题讨论】:

    标签: visual-studio visual-studio-2013 nuget nuget-package nuget-package-restore


    【解决方案1】:

    它确保导入的 .props 和 .targets 文件确实被导入。 NuGet 从2.5 开始支持 NuGet MSBuild。 EnsureNuGetPackageBuildImports 代码是在 9 月添加的,但我认为这是 2.8 的更改。不幸的是,它看起来像一个非向后兼容的变化。我们有一些 2.7 的开发人员现在需要升级到 2.8。我在 line 11 上的 Common/MsBuildProjectUtility.cs 中找到了 EnsureNuGetPackageBuildImports。

    【讨论】:

    • 我想知道“ctaggart/nuget”存储库(您链接的那个)是否真的准确。也许您改为链接到“NuGet/NuGet.Client”。它还具有带有 EnsureNuGetPackageBuildImports 的 MSBuildProjectSystem.cs file,它似乎是官方的 nuget 源。
    • 看来EnsureNuGetPackageBuildImports不关心nuget包的存在?
    • “NuGet 已支持 NuGet MSBuild 支持”是什么意思?
    猜你喜欢
    • 2011-08-10
    • 2011-01-17
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    • 2013-10-22
    • 2017-07-13
    • 1970-01-01
    相关资源
    最近更新 更多