Skip to content

Packaging components

Ryan Lengel Isgrig edited this page Feb 3, 2021 · 2 revisions

If your component consists solely of declarative assets (no code) you can publish to both NuGet and NPM feeds. Follow the instructions for

  1. .nuspec
  2. package.json

Packaging for NuGet

.nuspec

A `.nuspec. file is an XML manifest that contains package metadata. This is used both to buil the package and to provide information to consumers. The manifest is always included in a package. Create a NuSpec file with the following properties.

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id><!--Namespace and component name --></id>
        <version><!-- Version number --></version>
        <authors>Microsoft</authors>
        <owners>Microsoft</owners>
        <releaseNotes><!-- Release notes related to the current version--></releaseNotes>
        <description><!-- A description of the package for UI display --></description>
        <tags>bf-component preview</tags>
        <dependencies />
    </metadata>

    <files>
        <file src="exported\**\*.*" target="exported" />
    </files>
</package>

.csproj

If the component has a .csproj file, add the following property group.

  <PropertyGroup>
    <PackageId><!--Namespace and component name --></PackageId>
    <PackageVersion><!-- Version number --></PackageVersion>
    <Description><!-- A description of the package for UI display --></Description>
    <Summary><!-- A short description of the package for UI display. If omitted, a truncated version of description is used. --></Summary>
    <Company>Microsoft</Company>
    <Authors>Microsoft</Authors>
    <Product>Microsoft Bot Builder SDK</Product>
    <Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
  </PropertyGroup>

Packaging for NPM

Add steps for generating package.json and preparing.

package.json

{
  "name": "<--namespace and component-->",
  "version": "<-- version -->",
  "keywords": [ "bf-component" ],
  "description": "<-- Add description -->",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Bot Framework",
  "license": "MIT"
}