Nuspec contentFiles example

NuGet 3.3 ( release notes ) was released yesterday and a new contentFiles element ( documents ) is supported . However, I cannot get this to work.

I am using NuGet.exe as a build process. It has been updated to v3.3. I also upgraded Visual Studio to 2015 Update 1 and rebooted.

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

And I get the following:

MSBuild: msbuild '14.0' 'C:\Program Files (x86)\MSBuild\14.0\bin'. "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 ".

, , XML- contentFiles, , , . ? , include , - nuspec contentFiles?

+6
2

<contentFiles> <metadata> 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>
        <contentFiles>
            <files include="*" />
        </contentFiles> 
    </metadata>
</package>
+9

@,

. , metadata/contentFiles, files. #, PowerShell /bin , PackageReference. XML . , , .

: (.. - cs/net45/YourFile.cs). / /MyFile.psm1, , . , .

, "contentFiles" .

( , .nuspec) https://docs.microsoft.com/en-us/nuget/reference/nuspec#inc-content-files

<package>
  <metadata>
    <id>SomeLibrary</id>
    <version>$version$</version>
    <title>SomeLibrary</title>
    <authors>Somebody</authors>
    <owners>Somebody</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Some library that does things I enjoy.</description>
    <releaseNotes />
    <copyright>Copyright 2017</copyright>
    <tags>PowerShell Testing</tags>
    <contentFiles>
      <files include="any/any/SomePS.psd1" buildAction="none" copyToOutput="true" />
      <files include="any/any/SomePS.psm1" buildAction="none" copyToOutput="true" />
    </contentFiles>
  </metadata>
  <files>
    <file src="*.dll" target="lib\net461" />
    <file src="*.pdb" target="lib\net461" />
    <file src="SomePS.psd1" target="contentFiles\any\any" />
    <file src="SomePS.psm1" target="contentFiles\any\any" />
  </files>
</package>
+1

Source: https://habr.com/ru/post/1618196/


All Articles