pack command
Overview
Packages an extension.
Format
NDExt pack [options]
Option
Option | Argument | Meaning |
---|---|---|
-p, --project | <project> | Specifies the target project directory. If not specified, searches and executes under the current directory. |
-v, --ndver | <ndver> | Target version of Next Design. If not specified, it is 3.0.0 . |
-c, --config | <config> | Specifies the build configuration. Specify Debug or Release . If not specified, it is Release . |
-o, --output | <output> | Specifies the storage folder for the created package. If not specified, it will be ndpackages . |
-d, --copydir | <copydir> | The created package will also be copied to the specified folder. |
Example of execution
When executed as follows, it will search for all extension projects (.csproj) in the current directory and below, build and package them.
c:\myproject\src> ndext pack
If the pack
command is executed successfully, a nupkg file will be created in the output folder. When you open the nupkg
file with NuGet Package Explorer, it will look like this.
The files under the pkgContents
folder of the project created with the new
command will be placed under samples and templates, respectively.
See the following page for how to publish and use the package you created.
Setting package properties
The information in the csproj file is used to set the package properties.
If you are using Visual Studio, you can set this information in the "Package" tab of the project properties. The following information is required.
Setting item | XML tag in csproj | Description |
---|---|---|
Package ID | PackageId | A unique name that distinguishes the package. Specify it as "MyCompany.SomePackage". |
Package description | Description | Used to describe the package. It can be any string. |
Version | Used as the version to identify the package. For example, "1.0.0". | |
Authors | Information about the package creator. Enter the company name, etc. |
You can also set other information for the package by specifying Copyright
and PackageProjectUrl
.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
<PackageId>SampleExt</PackageId>
<Version>1.0.0</Version>
<PackageProjectUrl>https://www.your-web-here.com/</PackageProjectUrl>
<Authors>Me</Authors>
<Company>Me</Company>
<Product>SampleExt</Product>
<Description>Please enter a description of SampleExt here. </Description>
<Copyright>(Copyright Here)</Copyright>
</PropertyGroup>
...
</Project>
If you run the pack
command on the above project file (csproj), the following nuspec file will be generated.
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>SampleExt</id>
<version>1.0.0</version>
<authors>Me</authors>
<owners>Me</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectUrl>https://www.your-web-here.com/</projectUrl>
<Description>Please enter a description of SampleExt here. </Description>
<releaseNotes></releaseNotes>
<copyright>(Copyright Here)</copyright>
</metadata>
</package>