NuGet 包忽略程序集信息

NuGet pack is ignoring assembly info

当我从命令行 运行 nuget pack MyProject.csproj 时,出现以下错误:

The replacement token 'author' has no value.

我检查了我的 AssemblyInfo,AssemblyCompany 被指定为“AJ Richardson”。我尝试在我的 nuspec 文件中手动将 $author$ 替换为 AJ Richardson,但随后出现了一个略有不同的错误:

The replacement token 'description' has no value.

但是AssemblyDescription也是指定的。 NuGet 似乎没有从我的 AssemblyInfo 中读取任何内容。我已验证 AssemblyInfo 包含在我的项目中并且构建操作设置为编译。

我之前制作了几个 NuGet 包,没有任何问题。这个包和我以前的包之间的唯一区别是这个包有依赖关系。

作为参考,这是我的 nuspec:

<?xml version="1.0"?>
<package>
  <metadata>
    <id>$id$</id>
    <version>1.0.0</version>
    <title>$title$</title>
    <authors>$author$</authors>
    <owners>$author$</owners>
    <licenseUrl>https://github.com/my/repo/blob/master/LICENSE</licenseUrl>
    <projectUrl>https://github.com/my/repo</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>Initial release.</releaseNotes>
    <copyright>Copyright AJ Richardson 2015</copyright>
    <tags></tags>
  </metadata>
  <dependencies>
    <dependency id="Newtonsoft.Json" version="6.0.1" />
  </dependencies>
</package>

所以我的问题是,为什么 NuGet 不读取我的 AssemblyInfo,我如何说服它这样做?

我认为问题在于我在修改 AssemblyInfo 之后还没有构建我的项目。我进行了重建,现在可以正常工作了。

(作为旁注,我在错误的部分中也有 <dependencies> - 它应该在 <metadata> 内部 - 但这并没有导致我的问题出现错误。)

我也遇到了这方面的问题;我对 AssemblyInfo 的更新似乎没有被接收 - 尽管我进行了构建和重建等

我能够通过显式告诉 NuGet 构建来解决问题(在我的情况下,在 Release 中,使用 pdb 符号):

nuget pack foo.csproj -Build -Symbols -Properties Configuration=Release

同样的问题,但事实证明有人引入了签名密钥,而我引用的程序集没有强名称。

奇怪的是我没有得到不同的错误。