【问题标题】:nuget pack with -IncludeReferencedProjects flag don't work when NET Framework project has project reference to netstandard project当 NET Framework 项目具有对 netstandard 项目的项目引用时,带有 -IncludeReferencedProjects 标志的 nuget 包不起作用
【发布时间】:2017-11-20 07:21:12
【问题描述】:

我有 2 个库:

  • 第一个库(First.csproj) - netstandard1.3
  • 第二个库(Second.csproj) - .Net framework 4.6.1

Second.csproj 具有对First.csproj 的项目引用。

编译成 VS2017 工作没有问题。

之后我想为 Second.csproj 创建 nuget 包,依赖于 First.csproj,但是命令

 nuget pack Second.csproj -IncludeReferencedProjects

因错误而失败

Error occurred when processing file 'E:\blabla\First.csproj': Unable to find 'bin\Release\First\bin\Release\'. Make sure the project has been built.
  Unable to find 'bin\Release\First\bin\Release\'. Make sure the project has been built.

我的 nuget 版本是最新的:NuGet 版本:4.4.1.4656

如何正确打包我的 .NET Framework 4.6.1 项目并添加对 netstandard 库的依赖项?

【问题讨论】:

  • 如果您希望第一个项目作为依赖项,它需要有一个与项目同名的 .nuspec 文件。
  • 我有。它在 First.csproj 是 Net 4.6.1 项目时工作。但是将项目类型更改为 netstandard1.3 后它不起作用。

标签: c# .net nuget


【解决方案1】:

这是 nuget 的一个已知错误:https://github.com/NuGet/Home/issues/4054

丑陋的解决方法:

1) 手动将First.csproj的包依赖添加到Second.csproj.nuspec文件中

<dependencies>
    <dependency id="First" version="actual version of First here" />
</dependencies>

2) 使用不带标志的 nuget pack -IncludeReferencedProjects

【讨论】:

    猜你喜欢
    • 2017-11-02
    • 1970-01-01
    • 2018-12-03
    • 1970-01-01
    • 1970-01-01
    • 2018-11-15
    • 1970-01-01
    • 1970-01-01
    • 2017-09-15
    相关资源
    最近更新 更多