NuGet Framework Assemblies not working

◇◆丶佛笑我妖孽 提交于 2019-12-23 06:50:10

问题


I'm trying to update a nuget package to add some assembly references, but I'm getting the following error:

The element 'metadata' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has invalid child element 'frameworkAssemblies' in namespace http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'. List of possible elements expected: 'dependencies, language, summary' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'

I believe this functionality was added in NuGet 1.2 - I'm using 1.2.2213.45.

Here's my nuspec file:

<?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>

回答1:


I think you have an outdated version of nuget.exe. You can simply run 'nuget update' and it will update itself to the latest (which as of today is 1.3.20425.372). Your nuspec should then work fine!




回答2:


I hit this too after installing/uninstalling VS11 Beta.

Reinstalling nuget from its codeplex project page sorted the issue out for me quite quickly.




回答3:


You can also get this error if you have placed an element in the wrong place.
e.g. You place the <dependencies> elements, outside of the <metadata> element.



来源:https://stackoverflow.com/questions/5847755/nuget-framework-assemblies-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!