Reputation: 205
I have included the following in my nuspec file:
<?xml version="1.0"?>
<package>
<metadata minClientVersion="3.3">
<contentFiles>
<file src="*.css" target="_css" />
</contentFiles>
</metadata>
</package>
However, I get the following error:
MSBUILD : OctoPack error OCTONUGET: The element 'metadata' 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: 'language, licenseUrl, projectUrl, requireLicenseAcceptance, summary, tags, frameworkAssemblies, title, references, copyright, authors, description, version, iconUrl, owners, dependencies, id, developmentDependency, releaseNotes' in namespace 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd'.
When I look here: https://blog.nuget.org/20160126/nuget-contentFiles-demystified.html, what I've done seems correct. What am I missing?
Upvotes: 0
Views: 2877
Reputation: 205
There were two problems with this.
One was as per the 'BikerDude' answer.
The second that the target did not begin with
lib, content, build, or tools
as per the documentation.
My final markup looked like this:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata minClientVersion="3.3">
<id>Application Id</id>
<version>$version$</version>
<description>Solution description</description>
<authors>Development Team</authors>
</metadata>
<files>
<file src="\_css\**\*.*" target="content\_css" />
<file src="\_scripts\**\*.*" target="content\_scripts" />
<file src="\_images\**\*.*" target="content\_images" />
</files>
</package>
I then created a virtual directory in IIS for the 'content' directory, so that the file references did not need to change.
Upvotes: -1
Reputation: 444
The NuSpec file reference indicates that <Contentfile>
and <File>
are two independent tags. You can't nest <file>
under <Contentfile>
Use the following pattern:
<files>
<file src="bin\Debug\*.dll" target="lib" />
<file src="bin\Debug\*.pdb" target="lib" />
<file src="tools\**\*.*" exclude="**\*.log" />
</files>
<contentfiles>
is only supported NuGet 3.3+, maybe you have an older NuGet(NuGet 2.x or earlier)?
Upvotes: 1