nuspec contentFiles 示例 [英] nuspec contentFiles Example

查看:12
本文介绍了nuspec contentFiles 示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Yesterday NuGet 3.3 was released (release notes) and there is a new contentFiles element supported (docs). However, I can't seem to get this working.

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

I'm using the NuGet.exe as the build process. It is updated to v3.3. I have also updated my Visual Studio to 2015 Update 1 and rebooted.

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

Here is my nuspec file (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>

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

I run from the command line using the following:

nuget.exe update -Self
nuget.exe pack Hello.world.nuspec

我得到以下信息:

MSBuild 自动检测:使用来自C:Program Files (x86)MSBuild14.0in"的 msbuild 版本14.0".尝试从Hello.world.nuspec"构建包.命名空间 'http://schemas.microsoft.com/packaging 中的元素 'package'/2010/07/nuspec.xsd'在命名空间'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.预期的可能元素列表:命名空间中的文件"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.

MSBuild auto-detection: using msbuild version '14.0' from 'C:Program Files (x86)MSBuild14.0in'. Attempting to build package from 'Hello.world.nuspec'. The element 'package' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' has invalid child element 'contentFiles' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'. List of possible elements expected: 'files' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.

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

I think I am running all the latest versions that should support the new contentFiles XML element, but the tools don't seem to know about it. What am I missing? I know the files include attribute is garbage, but does someone have a full example nuspec file using the new contentFiles element?

推荐答案

元素 <contentFiles> 必须在 根据 NuSpec 参考.所以它应该是这样的:

Element <contentFiles> has to be inside <metadata> according to NuSpec reference. So it should look like this:

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

这篇关于nuspec contentFiles 示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆