NuGet不会向包添加依赖项

时间:2017-08-18 11:08:16

标签: wpf dependencies nuget nuget-package

我正在尝试使用NuGet pack命令打包我的WPF应用程序。到目前为止,我发现添加 -IncludeReferencedProjects 可以解决引用项目无法打包的问题。

./nuget.exe pack {path}.csproj -NonInteractive -OutputDirectory C:\test -Properties Configuration=release -version 0.1.0 -Verbosity Detailed -IncludeReferencedProjects

我面临的问题是项目的依赖关系没有被打包。但它们会显示在日志中,如下所示。依赖关系:EntityFramework。

enter image description here

但依赖项永远不会添加到包中。即使我手动检查或部署软件包,也只部署 Data.dll {name} .exe

我已尝试过(通过搜索Google / SO):

  • 为csproj文件添加NuSpec文件
  • NuGet.config,引用了正确的packages文件夹(如果NuGet没有找到它)

编辑:添加生成的.nuspec

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
    <metadata>
        <id>{path}.UpgradeDatabase</id>
        <version>0.1.4</version>
        <title>{path}.UpgradeDatabase</title>
        <authors>stephanbisschop</authors>
        <owners>stephanbisschop</owners>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>Description</description>
        <copyright>Copyright ©  2016</copyright>
        <dependencies>
            <dependency id="EntityFramework" version="6.1.3" />
        </dependencies>
    </metadata>
</package>

enter image description here

提前谢谢你, 斯蒂芬

1 个答案:

答案 0 :(得分:0)

问题解决了。 我的NuGet包没有错过依赖关系..它是Octopus Deploy还没有恢复包。我们通过在相应的.NuSpec文件中添加条目来修复它。现在所有的.dll,.config等文件都打包了。