C + + essay Nuget packaging

First, prepare all the compiled packages to a folder
Like this

Next, create a new text document with the suffix. nuspec Fill in content

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
    <metadata>
        <!-- The unique identification number of the package, which is also the package name -->
        <id>Google.Grpc</id>

        <!-- The version of the package, which needs to be used when the version dependency problem needs to be solved -->
        <version>1.20.0</version>

        <!-- author -->
        <authors>Pulsar-V,Zhijia Tao</authors>

        <!-- Author identifier to find their shared package in the repository -->
        <owners>Pulsar-V</owners>
        
         <!-- Address of the project -->
        <projectUrl>https://github.com/grpc/grpc</projectUrl>

         <!-- License certificate -->
        <license type="expression">Apache-2.0</license>
        

        <!-- Visual Studio It needs to be shown UI Icon -->
        <iconUrl>https://grpc.io/img/grpc_inverse.svg</iconUrl>

        <!-- If true, the user needs to accept the license before installing -->
        <requireLicenseAcceptance>true</requireLicenseAcceptance>

        <!-- More about this release -->
        <releaseNotes>Release for windows Grpc</releaseNotes>

        <!-- 
            Description information seen in Package Manager. 
        -->
        <description>CPP Windows 10 x64 plathform Grpc</description>

        <!-- Copyright information -->
        <copyright>Copyright ©2016 Contoso Corporation</copyright>

        <!-- Tags in the library, which can be used for tag search -->
        <tags>cpp parsing web rpc</tags>
		
    </metadata>

    <!-- The first line, shown when installing the package readme.txt -->
    <files>
        <file src="readme.txt" target="" />
		
		<!-- The files contained in the package and the path after packaging -->
		<file src=".\x64\lib\**" target="x64\lib" />
		<file src=".\x64\include\**" target="x64\include" />
		<file src=".\x64\bin\**" target="x64\bin" />
		
		<file src=".\x86\lib\**" target="x86\lib" />
		<file src=".\x86\include\**" target="x86\include" />
		<file src=".\x86\bin\**" target="x86\bin" />
    </files>
</package>

Start packing

nuget pack grpc-1.20.0-v141.nuspec

Now, a package called Google.Grpc.1.20.0.nupkg is generated under the schedule by directory

Next, install our package locally and test the availability of the package

nuget add Google.Grpc.1.20.0.nupkg -Source E:\nuget\packages


You can see that a new package ID related folder has been created under E:\nuget\packages, which contains the package we just packed

Next try installing

nuget install Google.Grpc -Source E:\nuget\packages

Note:% appdata%\NuGet\NuGet.Config(Windows) and ~ /. nuget/NuGet/NuGet.Config(Mac/Linux). Is the default nuget source configuration path

view folders

There is no shortage of one. The installation is successful

Reference document

How to pack

Sources command (NuGet CLI)sources command (NuGet CLI)

Keywords: Programming Google Windows xml github

Added by tom_b on Mon, 25 Nov 2019 22:51:15 +0200