NuGet框架程序集无法工作

19
我试图更新一个NuGet包以添加一些程序集引用,但是我遇到了以下错误:

名称空间为 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' 的元素'metadata'具有名称空间'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'中的无效子元素'frameworkAssemblies'。预期的可能元素列表为:名称空间为 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' 中的 'dependencies、language、summary'。

我认为这个功能是在 NuGet 1.2 版本中添加的 - 我正在使用 1.2.2213.45 版本。
这是我的 nuspec 文件:
<?xml version="1.0"?>
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
        <id>PetaPoco.Core</id>
        <title>PetaPoco.Core - A tiny ORMish thing for your POCOs (Core Only)</title>
        <version>3.0.0</version>
        <authors>Topten Software</authors>
        <owners>Topten Software</owners>
        <licenseUrl>http://www.toptensoftware.com/petapoco/license</licenseUrl>
        <projectUrl>http://www.toptensoftware.com/petapoco/</projectUrl>
        <iconUrl>http://www.toptensoftware.com/petapoco/nuget_icon.png</iconUrl>
        <requireLicenseAcceptance>true</requireLicenseAcceptance>
        <description>
PetaPoco is a tiny, single file .NET data access layer inspired by Massive that works with both non-dynamic POCO objects and dynamics.

This package includes the just the core PetaPoco library (ie: no T4 templates)

        </description>
        <tags>ORM POCO MVC MVC2 MVC3 ASP.NET WebForms WebMatrix MySQL Database</tags>
        <frameworkAssemblies>
            <frameworkAssembly assemblyName="System.Data" />
            <frameworkAssembly assemblyName="System.Configuration" />
        </frameworkAssemblies>
    </metadata>
    <files>
        <file src="PetaPoco.cs" target="Content\Models" />
    </files>
</package>
3个回答

21

我认为你使用的是过时版本的nuget.exe。你可以运行 'nuget update' 命令,它会将自身更新到最新版本(截至今天为止最新版本为 1.3.20425.372)。然后你的nuspec应该就能正常工作了!


谢谢David,它起作用了。很奇怪,因为我实际上卸载了NuGet并安装了1.3。VS扩展管理器显示1.3,但命令行仍然是1.2。 - Brad Robinson
实际上,nuget.exe根本没有与VS扩展一起提供,所以您可能在某个时候从其他地方获取了它。检查其位置可能有助于记住它是如何到达那里的。 - David Ebbo

4
您也可能会遇到此错误,如果您将元素放在了错误的位置。 例如:将<dependencies>元素放在了<metadata>元素之外。

2

在安装/卸载VS11 Beta后,我也遇到了这个问题。

其CodePlex项目页面重新安装NuGet很快就解决了我的问题。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接