2
votes

I have a nuspec file for a package containing UWP as well as Android and iOS assemblies.

In the UWP version I also need to include a content file. According to this reference, I should use the contentFiles tag, which works fine in the following code and in the generated package file I have the files added:

<?xml version="1.0"?>
<package>
  <metadata minClientVersion="3.3.0">
    <id>x</id>
    <version>1.0.1</version>
    <authors>...</authors>
    <description>...</description>       
   <contentFiles>        
        <files include="**/images/*.*" ... />        
    </contentFiles>
  </metadata>
</package>

However, I also need to include assemblies, for which I have to use the files node:

<?xml version="1.0"?>
<package>
  <metadata minClientVersion="3.3.0">
    ...
  </metadata>  
  <files>
    <file src="..." target="..." />    
  </files>  
</package>

In this case, the content files are just ignored. In other words, as soon as I add the files node, the contentFiles node is not even added to the generated package!

Is this a bug in Nuget.exe? Is this by design? How can I have both in the package?!

PS: My nuget.exe is the latest official one.

3

3 Answers

0
votes

According to the docs, under the Including content files, you should use one or the other, as the ContentFiles is for the project.json

Try to move your content to your file tag, it should look like this:

<?xml version="1.0"?>
<package>
    <metadata minClientVersion="3.3.0">
        ...
    </metadata>  
    <files>
        <file include="**/images/*.*" target="Content" />
        <file src="..." target="..." />    
    </files>  
</package>
0
votes

When you add the files section to your nuspec file, you then need to manually list all of the files you want in your package, including the content files you've listed in the contentFiles section.