为什么NuGet包会忽略内容文件?

时间:2019-01-29 15:57:15

标签: nuget nuspec

当尝试向NuGet包中添加任意内容文件时,通过<files>元素指定的文件将被完全忽略。它们不是事件收集到nupkg存档中。

<files>文件中的

nuspec部分:

<files>
    <file src="bin/Release/de-DE/*.resources.dll" target="contentFiles/any/any/de-DE" />
</files>

此目录中有两个文件:

  • ApplicationName.resources.dll
  • LibraryName.resources.dll

但是nupkg中都不包含它们。

<files>部分的构建方式与Microsoft文档建议的相同:https://docs.microsoft.com/en-us/nuget/reference/nuspec#including-assembly-files

1 个答案:

答案 0 :(得分:0)

Microsoft文档似乎是错误的。尽管<contentFiles>部分允许使用通配符,但<files>部分似乎不允许使用通配符。

<file>规范更改为不带通配符的显式路径,以使每个文件末尾都有一个:

<files>
    <file src="bin/Release/de-DE/ApplicationName.resources.dll" target="contentFiles/any/any/de-DE" />
    <file src="bin/Release/de-DE/LibraryName.resources.dll" target="contentFiles/any/any/de-DE" />
</files>
相关问题