【发布时间】:2017-08-18 22:12:17
【问题描述】:
我正在尝试使用 NuGet pack 命令打包我的 WPF 应用程序。到目前为止,我发现添加 -IncludeReferencedProjects 可以解决引用项目没有打包的问题。
./nuget.exe pack {path}.csproj -NonInteractive -OutputDirectory C:\test -Properties Configuration=release -version 0.1.0 -Verbosity Detailed -IncludeReferencedProjects
我面临的问题是项目的依赖项没有打包。但是,它们确实显示在日志中,如下所示。依赖:EntityFramework。
但从不将依赖项添加到包中。即使我手动检查或部署包,也只部署了 Data.dll 和 {name}.exe。
我已经尝试过的(通过搜索 Google/SO):
- 为 csproj 文件添加 NuSpec 文件
- NuGet.config 引用正确的包文件夹(以防 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>
提前谢谢你, 斯蒂芬
【问题讨论】:
-
你能显示 nuspec 文件吗?这通常是要走的路。
-
顺便说一下,有几个选项可以指定依赖关系;您可以按版本或文件添加它们,但这取决于您要如何处理它们。你可以在这里阅读:docs.microsoft.com/en-us/nuget/schema/nuspec
-
我使用 nuspec xml 和 nuget 包浏览器屏幕截图编辑了我的帖子。
-
嗯,依赖不是静态添加到包中的。在我看来,如果你运行 install-package 命令,它也会安装依赖项。这还不够吗?
-
问题是当我们部署这个包时,我们只得到:lib -> net461 -> data.dll 和 {file}.exe。所以 NuGet 在部署后不知道要安装什么。
标签: wpf dependencies nuget nuget-package