Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Note
The Retail Interest Group by Dynamics 365 Commerce has moved from Yammer to Viva Engage. If you don't have access to the new Viva Engage community, fill out this form (https://aka.ms/JoinD365commerceVivaEngageCommunity) to be added and stay engaged in the latest discussions.
This article describes how to download Microsoft Dynamics 365 Commerce software development kit (SDK) samples from GitHub and reference packages.
Note
This article applies to Commerce SDK version 10.0.16 or later. For more information about how to download earlier versions of the Commerce SDK, see Retail software development kit (SDK).
The Commerce SDK includes the code, code samples, templates, and tools that you need to extend or customize Dynamics 365 Commerce functionality. The SDK is published in different repositories (repos) in GitHub, depending on the extension components.
The Commerce SDK supports rapid development, full MSBuild integration, and package generation. The following image shows the relationship between the development environment and the cloud components.
Extension components in Dynamics 365 Commerce
The following tables provide information about the components in the Commerce SDK that you can customize for different scenarios.
Client (Store Commerce)
| Scenario | Commerce SDK reference | Technology | Documentation |
|---|---|---|---|
| Extend the Store Commerce app for user experience (UX) changes, client logic, workflows, and simple validations. | Store Commerce app samples | TypeScript, HTML, and CSS | Run the point of sale (POS) samples |
Commerce Runtime (CRT)
| Scenario | Commerce SDK reference | Technology | Documentation |
|---|---|---|---|
| Extend CRT to add or change business logic, such as logic for calculating tax, prices, or discounts. | CRT samples | C# | Commerce runtime (CRT) and Retail Server extensibility |
Headless Commerce APIs
| Scenario | Commerce SDK reference | Technology | Documentation |
|---|---|---|---|
| Create a Headless Commerce API extension to expose new Commerce APIs to the client. | Retail Server samples | Open Data Protocol (OData) and C# | Create a new Retail Server extension API (Retail SDK version 10.0.11 and later) |
TypeScript proxy
| Scenario | Commerce SDK reference | Technology | Documentation |
|---|---|---|---|
| Use a TypeScript proxy when you need to consume new Headless Commerce API extensions in the POS or E-Commerce clients. | CommerceProxyGenerator | OData and C# | Create a new Retail Server extension API (Retail SDK version 10.0.11 and later) |
Hardware station
| Scenario | Commerce SDK reference | Technology | Documentation |
|---|---|---|---|
| Add or change logic related to peripherals. | src\HardwareStationSample samples | C# | Integrate POS with a new hardware device |
Payment connector
| Scenario | Commerce SDK reference | Technology | Documentation |
|---|---|---|---|
| Integrate the POS with a new payment connector. | src\HardwareStationSample\PaymentDevices | C# | Create an end-to-end payment integration for a payment terminal |
Best practices for naming
The C# source code in the Commerce SDK uses the Contoso namespace. Therefore, it's easier to distinguish Microsoft types and extension types. If your extension code references a type from the Microsoft binary, use Microsoft.Dynamics for the reference, to distinguish between Microsoft libraries and the libraries from the extension. The extension libraries must not begin with the Microsoft.Dynamics name.
Deployment packages
After you develop extensions (CRT, Retail Server, database scripts, POS, and Hardware station), generate deployment packages to deploy into test, sandbox, and production environments. For more information, see Create deployable packages.
The following sample repositories contain code samples, templates, and tools that are required to extend or customize existing Commerce functionality. Microsoft publishes samples to repositories in GitHub based on the Commerce extension components. You don't have to clone these repositories. Instead, you can download and use the samples and template projects.
Dynamics365Commerce.ScaleUnit repository
The Dynamics365Commerce.ScaleUnit repository contains the sample code for customizing the Commerce runtime (CRT), Retail Server, and channel database.
The samples in the repository are organized by Dynamics 365 Commerce application release. Each branch in the repository points to an application release of Dynamics 365 Commerce. Use the release branch that matches your go-live version. You don't have to clone this repository. Instead, you can download and use the samples and template projects.
| Release branch name | Version | Application release version |
|---|---|---|
| Release/9.38 | 9.38.* | 10.0.28 |
| Release/9.37 | 9.37.* | 10.0.27 |
| Release/9.36 | 9.36.* | 10.0.26 |
Extension repository (Dynamics365Commerce.ScaleUnit)
You can download and use the samples and templates from microsoft/Dynamics365Commerce.ScaleUnit. The repository contains nuget.config, repo.props, CustomizationPackage.props, and a build pipelines script. Together they provide guidance on how the extension can set up the repository metadata files.
Dynamics365Commerce.ScaleUnit repository folders and projects
| Folder | Project | Description |
|---|---|---|
| Channel Database (./src/ScaleUnitSample/ChannelDatabase) | ChannelDatabase.csproj (./src/ScaleUnitSample/ChannelDatabase/ChannelDatabase.csproj) | This project contains samples on how to create Commerce Runtime database extensions. |
| CommerceRuntime (./src/ScaleUnitSample/CommerceRuntime) | CommerceRuntime.csproj (./src/ScaleUnitSample/CommerceRuntime/CommerceRuntime.csproj) | Controller – Sample code for how to implement new RS APIs. Entities, Messages, and RequestHandlers – Sample code for how to implement new CRT service. |
| ScaleUnit (./src/ScaleUnitSample/ScaleUnit) | ScaleUnit.csproj (./src/ScaleUnitSample/ScaleUnit/ScaleUnit.csproj) | Sample project on how to generate the Cloud Scale Unit (CSU). |
| ScaleUnit.Installer (./src/ScaleUnitSample/Installer) | ScaleUnit.csproj (./src/ScaleUnitSample/Installer/ScaleUnit.Installer.csproj) | Sample project on how to generate the CSU installer. |
| POS (./src/ScaleUnitSample/POS) | POS.csproj (./src/ScaleUnitSample/POS/POS.csproj) | Contains samples on how to create Point Of Sale (POS) extensions. |
| E-CommerceProxyGenerator (./src/ScaleUnitSample/E-CommerceProxyGenerator) | E-CommerceProxyGenerator.csproj (./src/ScaleUnitSample/E-CommerceProxyGenerator/E-CommerceProxyGenerator.csproj) | Contains a sample on how to generate extension proxies for E-Commerce application. |
Samples for in-store components like the Store Commerce app, Store Commerce for web, Hardware station and Cloud scale unit – Self hosted are published in the Dynamics365Commerce.InStore repository.
The readme.md files in the Commerce Runtime, ChannelDatabase and ScaleUnit folders contain more details on how to run the samples.
Dynamics365Commerce.InStore repository
The Dynamics365Commerce.InStore repository contains the sample code for how to customize POS, Hardware station, Commerce runtime (CRT), headless Commerce APIs, and the channel database.
The samples in the repository are organized by Dynamics 365 Commerce application release, each branch in the repository points to an application release of Dynamics 365 Commerce. Use the release branch that matches your go-live version. You don't have to clone this repository, instead, you can download and use the samples and template projects.
| Release branch name | Version | Application release version |
|---|---|---|
| Release/9.38 | 9.38.* | 10.0.28 |
| Release/9.37 | 9.37.* | 10.0.27 |
| Release/9.36 | 9.36.* | 10.0.26 |
Extension repository (Dynamics365Commerce.InStore)
You can download and use the samples and templates from microsoft/Dynamics365Commerce.InStore. The repository contains nuget.config, repo.props, CustomizationPackage.props, and a build pipelines script. Together, these files provide guidance on how the extension can set up the repository metadata files.
Dynamics365Commerce.InStore repository folders and projects
| Folder | Project | Description |
|---|---|---|
| HardwareStationSample | HardwareStation.Samples.sln | This project contains samples on how to create Hardware station, Payment extensions, and extension installers. |
| POSSample | Pos.sln | This folder and project contain POS, CRT, headless Commerce APIs, and Hardware station extension and installer samples. |
More samples for CSU – self hosted, Commerce Runtime, and headless Commerce APIs are published in the Dynamics365Commerce.ScaleUnit repository.
The readme.md files inside the project folders contain more details on how to run these samples.
Dynamics365Commerce.Solutions repository
The Dynamics365Commerce.Solutions repository contains a sample that demonstrates how to perform E2E business scenario customization in Commerce. There might be scenarios where you need to customize POS, e-Commerce, or the headless commerce engine.
Download reference packages for creating APIs, and for consuming messages, request, entities, and contracts
Developers publish Commerce contracts, messages, entities, and request packages in this public feed for Commerce extension code that consumes and customizes existing functionalities, or builds new functionalities for the Dynamics 365 Commerce application.
Use the packages from index.json. Add the package source location in the nuget.config file of your extension project file, as shown in the following code example:
<packageSources>
<add key="dynamics365-commerce" value="https://pkgs.dev.azure.com/commerce-partner/Registry/_packaging/dynamics365-commerce/nuget/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
Reference packages that are available in the public feed
| Package name | Description |
|---|---|
| Microsoft.Dynamics.Commerce.Sdk.ChannelDatabase | You need this package to generate the DB packages with CSU. |
| Microsoft.Dynamics.Commerce.Sdk.Runtime | This meta package contains all the required packages for implementing the CRT and Retail Server extensions. It includes all the required contracts, messages, requests/responses, and entities. |
| Microsoft.Dynamics.Commerce.Sdk.ScaleUnit | You need this package to generate the CSU package for deployment. |
| Microsoft.Dynamics.Commerce.Sdk.Installers.ScaleUnit | You need this package to generate the ScaleUnit package for deployment. |
| Microsoft.Dynamics.Commerce.Sdk.HardwareAndPeripherals | This package contains all commerce Hardware station and peripherals libraries. |
| Microsoft.Dynamics.Commerce.Sdk.Installers | This package contains all the installer libraries. |
| Microsoft.Dynamics.Commerce.Sdk.Installers.HardwareStation | You need this package to generate the Hardware station package for deployment. |
| Microsoft.Dynamics.Commerce.Sdk.Pos | This package contains all POS libraries. |
| Microsoft.Dynamics.Commerce.Sdk.Installers.ModernPos | You need this package to generate the POS extension installer for deployment. |
| Microsoft.Dynamics.Commerce.Diagnostics | This package contains all the diagnostic libraries. |
| Microsoft.Dynamics.Commerce.Runtime.Data | This package contains all the data contract libraries. |
| Microsoft.Dynamics.Commerce.Runtime.DataServices.Messages | This package contains all the data services message libraries. |
| Microsoft.Dynamics.Commerce.Runtime.Entities | This package contains all the entity definitions. |
| Microsoft.Dynamics.Commerce.Runtime.Framework | This package contains all the framework libraries. |
| Microsoft.Dynamics.Commerce.Runtime.Hosting.Contracts | This package contains all the controller libraries. |
| Microsoft.Dynamics.Commerce.Runtime.Messages | This package contains all the runtime messages libraries. |
| Microsoft.Dynamics.Commerce.Runtime.RealtimeServices.Messages | This package contains all the real runtime libraries. |
| Microsoft.Dynamics.Commerce.Runtime.Services.Messages | This package contains all the service messages libraries. |
| Microsoft.Dynamics.Commerce.HardwareStation.Core | This package contains all the Hardware station libraries. |
| Microsoft.Dynamics.Commerce.HardwareStation.PeripheralRequests | This package contains all the Hardware station peripherals request libraries. |
| Microsoft.Dynamics.Commerce.HardwareStation.Peripherals.Contracts | This package contains all the Hardware station peripherals contracts libraries. |
| Microsoft.Dynamics.Commerce.HardwareStation.Peripherals.Entities | This package contains all the Hardware station peripherals entities libraries. |
| Microsoft.Dynamics.Commerce.Installers.Framework | This package contains all the installer framework libraries. |
| Microsoft.Dynamics.Commerce.KeyVault.Contracts | This package contains all the key vault contract libraries. |
| Microsoft.Dynamics.Commerce.PaymentSDK.Extensions.Portable | This package contains all the payment extension libraries. |
| Microsoft.Dynamics.Commerce.PaymentSDK.Portable | This package contains all the payment libraries. |
| Microsoft.Dynamics.Commerce.Runtime.FIF.Connector.Messages | This package contains all the FIF connector libraries. |
| Microsoft.Dynamics.Commerce.Runtime.FIF.DocumentProvider.Messages | This package contains all the FIF document provider libraries. |
| Microsoft.Dynamics.Commerce.Installers.Framework.DatabaseExtensions | This package contains all the database installer framework libraries. |
| Microsoft.Dynamics.Commerce.Tools.DbUtilities | This package contains all the database utility libraries. |
| Microsoft.Dynamics.Commerce.Tools.ExtensionsProxyGenerator.AspNetCore | This package contains all the extensions proxy generator utilities. |
| Microsoft.Dynamics.Commerce.Proxy.ScaleUnit | This package contains all the proxies class for extension applications to consume the headless Commerce APIs in online mode (connected to headless Commerce). |
Package versioning
| Package version | Application release |
|---|---|
| 9.36.x.x-preview | 10.0.26 PEAP/Preview release |
| 9.36.x.x | 10.0.26 Customer preview |
| 9.36.x.x | 10.0.26 GA |
| 9.37.x.x-preview | 10.0.27 PEAP/Preview release |
| 9.37.x.x | 10.0.27 Customer preview |
| 9.37.x.x | 10.0.27 GA |
| 9.38.x.x-preview | 10.0.28 PEAP/Preview release |
| 9.38.x.x | 10.0.28 Customer preview |
| 9.38.x.x | 10.0.28 GA |
An extension project can consume the correct version if you add the package reference to the project and include the full version number. Alternatively, to make the extension project always get the latest version, use a wildcard character. Use the full version number and update the version based on your go-live version. There are two options:
Without a wildcard character:
<PackageReference Include="Microsoft.Dynamics.Commerce.Sdk.Runtime" Version="9.28" />;With a wildcard character:
<PackageReference Include="Microsoft.Dynamics.Commerce.Sdk.Runtime" Version="9.28.*" />;
For every hotfix and new application release, the same public feed hosts a version of the package. Consume the right package version based on the version required for your go-live version. Consuming a higher version of the package than your go-live application version can result in runtime and deployment failures.
Set up an Azure pipeline for build automation and package generation
For information about setting up an Azure pipeline, see Set up a build pipeline for the independent-packaging SDK.
Best practice and branching strategies
For detailed information about the Git branching strategy, see Git branching strategy.
The following branching strategies are based on the way that Microsoft uses Git. For more information, see How we use Git at Microsoft.
Keep your branch strategy simple. Build your strategy from these three concepts:
- Use feature branches for all new features and bug fixes.
- Merge feature branches into the main branch by using pull requests.
- Keep a high quality, up-to-date main branch.
Create a new feature branch for development and bug fixes
Create a new feature main branch for your extension, following the naming convention in Git branching doc for sample naming convention.
Create a new development branch
To create a new development branch, follow these steps:
Create a private branch for development.
- git checkout -b private/{username}/{feature/description}Add and commit the changes to the development branch. For example:
git -add . git commit -m "commit message"After you complete, test, and validate the development, push the changes to the main branch. For example:
git push <remote> <branch>Or:
git push origin {private branch name}
Create a release branch after development
To create a release branch after development, follow these steps:
After you push the development changes to the main branch, create a new release branch. Create the deployable packages from the release branch.
- Git checkout -b release/x.x.xMerge the changes from the release branch back to main branch if you made any changes in the release branch. For example:
- git checkout main git merge release/x.x.x
Extension hotfix branch
- Create a hotfix branch for the extension from the main branch. For more information, see Create a release branch after development.
- Release the fix.
- Merge the changes back to the main branch.
Merge a new release branch to main and development branch
After releasing a new version of the samples, if necessary, merge your development branch with the new branch. The repository contains only samples, so you don't need to get the updated changes from the branch. For example:
- git checkout main git merge release/x.x.x