Edit

Share via


Create a Store Commerce extension installer package

This article describes how to create a Microsoft Dynamics 365 Commerce Store Commerce extension installer package.

Note

You can find the full code samples in the Store Commerce Extension samples GitHub repository (repo).

To create the extension installer for Store Commerce extension, follow these steps.

  1. In Microsoft Visual Studio 2022, create a new .NET console application project named "StoreCommerce.ExtInstaller". For Framework, select .NET 7.0 (Standard Term Support).

  2. In the .proj file, change the target framework to the .NET Framework version 4.7.2, as shown in the following XML example.

    <Project Sdk="Microsoft.NET.Sdk">
        <PropertyGroup>
            <OutputType>Exe</OutputType>
            <TargetFramework>net472</TargetFramework>
        </PropertyGroup>
    </Project>
    
  3. Delete the Program.cs file that was generated.

  4. Add a reference to the Microsoft.Dynamics.Commerce.Sdk.Installers.StoreCommerce NuGet package:

    1. In Solution Explorer, right-click the project, and then select Manage NuGet packages.
    2. In the NuGet Package Manager window, on the Browse tab, search for Microsoft.Dynamics.Commerce.Sdk.Installers.StoreCommerce.
    3. Select the package, and then select Install.
    4. Select the version that matches your go-live version.
  5. Add a reference to the Store Commerce extension .csproj projects, Commerce runtime (CRT), and database script project extensions:

    1. In Solution Explorer, right-click the project, and then select Add > Reference.
    2. In Reference Manager, on the Projects tab on the left, select the extension project that you created earlier.
  6. Compile and build the project. The output of this project contains the Store Commerce extension installer. When you select the F5 key and build the project, the installer is deployed automatically.

  7. To manually install the extension, open Windows PowerShell in administrator mode, go to the extension installer folder, and run the following install command.

    PS C:\StoreCommerce.ExtInstaller\bin\Debug\net472> .\ StoreCommerce.ExtInstaller.exe install
    

    Note

    Before you install the extension installer, install the Store Commerce app.

    To uninstall the extension, run the following uninstall command.

    PS C:\StoreCommerce.ExtInstaller\bin\Debug\net472> .\ StoreCommerce.ExtInstaller.exe uninstall
    
  8. After you finish installing the extension, close Store Commerce if it's running. Then, to load the extension, open Store Commerce by using the Store Commerce shortcut on the desktop.

Note

Although code signing isn't a strict requirement for the Store Commerce extension installer like for Modern POS (MPOS), Microsoft recommends using code signing to verify the authenticity of any executable run on POS registers. You can configure your Azure DevOps pipeline to use the Trusted Signing - Visual Studio Marketplace task to digitally sign your files using a Trusted Signing certificate during an Azure Pipelines run.

Sample code

<Project Sdk="Microsoft.NET.Sdk">
    <Import Project="..\CustomizationPackage.props " />
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net472</TargetFramework>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Microsoft.Dynamics.Commerce.Sdk.Installers.StoreCommerce" Version="$(CommerceSdkPackagesVersion)" />
    </ItemGroup>
    <ItemGroup>
        <ProjectReference Include="..\CommerceRuntime\Contoso.GasStationSample.CommerceRuntime.csproj">
            <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
        </ProjectReference>
        <ProjectReference Include="..\Pos\Contoso.GasStationSample.Pos.csproj">
            <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
        </ProjectReference>
    </ItemGroup>
    <ItemGroup>
        <!-- Settings included in the CommerceRuntimeExtensionSettings item group will be added to the generated CommerceRuntime config file and available at runtime in the CommerceRuntime extension. -->
        <CommerceRuntimeExtensionSettings Include="ext.Contoso.GasolineItemId">
            <Value>gasoline</Value>
        </CommerceRuntimeExtensionSettings>
    </ItemGroup>
</Project>