nuspec contentFiles示例 [英] nuspec contentFiles Example
问题描述
昨天发布了NuGet 3.3(发行说明),并且有一个新的支持contentFiles元素(文档).但是,我似乎无法正常工作.
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)\ MSBuild \ 14.0 \ bin'的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 ".
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'. 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元素的最新版本,但是这些工具似乎对此并不了解.我想念什么?我知道文件的include属性是垃圾,但是有人使用new 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>
必须位于<metadata>
内,根据
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屋!