nuspec contentFiles示例

Tim*_*nke 6 nuget nuspec

昨天发布了NuGet 3.3(发行说明),并且支持新的contentFiles元素(docs).但是,我似乎无法让这个工作.

我正在使用NuGet.exe作为构建过程.它更新到v3.3.我还将Visual Studio更新到2015 Update 1并重新启动.

这是我的nuspec文件(Hello.world.nuspec):

<?xml version="1.0" encoding="utf-8"?>
<package>
    <metadata minClientVersion="3.3">
        <id>Hello.world</id>
        <version>1.0.0</version>
        <title>Greeting library</title>
        <authors>Timothy Klenke</authors>
        <description>Greetings for the world</description>
    </metadata>
    <contentFiles>
        <files include="*" />
    </contentFiles> 
</package>
Run Code Online (Sandbox Code Playgroud)

我使用以下命令从命令行运行:

nuget.exe update -Self
nuget.exe pack Hello.world.nuspec
Run Code Online (Sandbox Code Playgroud)

我得到以下内容:

MSBuild自动检测:在'C:\ Program Files(x86)\ MSBuild\14.0\bin'中使用msbuild版本'14 .0'.试图从'Hello.world.nuspec'构建包.元素命名空间"包' http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd具有无效子元素"contentFiles"命名空间" http://schemas.microsoft.com/packaging/ 2010/07/nuspec.xsd '.期望的可能元素列表:名称空间" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd "中的"文件".

我想我正在运行应该支持新的contentFiles XML元素的所有最新版本,但这些工具似乎并不了解它.我错过了什么?我知道文件包含属性是垃圾,但有人使用新的contentFiles元素有一个完整的示例nuspec文件吗?

Pet*_*sky 9

根据NuSpec参考,元素<contentFiles>必须在里面.所以看起来应该是这样的:<metadata>

<?xml version="1.0" encoding="utf-8"?>
<package>
    <metadata minClientVersion="3.3">
        <id>Hello.world</id>
        <version>1.0.0</version>
        <title>Greeting library</title>
        <authors>Timothy Klenke</authors>
        <description>Greetings for the world</description>
        <contentFiles>
            <files include="*" />
        </contentFiles> 
    </metadata>
</package>
Run Code Online (Sandbox Code Playgroud)

  • 彼得,我猜你遇到了同样的问题.您已经问过这个问题:http://stackoverflow.com/questions/34045140/deployment-of-contentfiles-in-nuget-3-3 (2认同)