Skip to main content

Create project

Overview

When developing a .NET DLL method extension, create a new project in Visual Studio and prepare the necessary files in the project. For example, when developing an extension named MyExtension using the .NET DLL method, the basic file structure is as follows.

src /
MyExtension.sln
MyExtension /
MyExtension.csproj
manifest.json
main.cs
resources /
button.png

You can choose one of the following methods to create a new project.

  • Create a project using the project template.
  • Manually create a project.
Preparation

You must have the .NET Core 3.1 SDK (https://dotnet.microsoft.com/download/dotnet/3.1) installed to develop extensions.

Create a project using a project template

When developing with Visual Studio, it is recommended to use the project template for Next Design extension development because it will save you a lot of work compared to the manual project described later.

install

If you are using the project template for the first time, you need to install it. Execute the following command from the command prompt. It doesn't matter where you run the directory.

dotnet new --install NextDesign.Extension.ProjectTemplates

Create a new project

After installing the template, you can create a project from Visual Studio. Start Visual Studio and select the extension development project from the dialog for creating a new project.

The following two types of project templates are available, so select Next Design Extension to create a project.

  • Next Design Extension ... A standard extension development project.
  • Next Design Extension (Extension Points) ... This is a project using ExtensionPoints Library which makes the definition of extension points very simple.
info
  • This topic assumes the use of standard extensions, but the Next Design Extension (Extension Points) template allows you to simply develop manifest definitions and handler implementations. See Using the ExtensionPoints Library for more information.
  • Project templates are available since Visual Studio 16.8 Prview 2. Please refer to Project Templates for troubles when the template is not displayed.

When you create a project, you can create a project that includes the manifest file and sample implementation of the extension as follows.

Manually create a project

The following describes how to create a new Visual Studio project and prepare the necessary files in the following order.

  • Create a new project
  • Register the extension development DLL
  • Prepare the manifest file

Create a new project

  • Run Create New Project in Visual Studio to create a new project for class library development in C#.

    Create a project with Visual Studio

  • Select .NET Core 3.1 for the framework.

    Project creation with Visual Studio 2

Register the extension development DLL

Get the following DLL with the NuGet package. Select your project's Dependencies from the Visual Studio Solution Explorer and run Manage NuGet Packages from the context menu.

Make sure the package source is nuget.org, type NextDesign on the Reference tab and search for it. The following package will be displayed, so install it.

NextDesign.Core NextDesign.Desktop

note

If the above DLL referenced in the extension development project and the version of the same DLL installed in the execution environment of the extension distribution destination do not match, the extension may not work properly.

Manifest file

The Next Design extension requires one file named manifest.json. This is called the Manifest. For the Next Design extension, define the extension point in the manifest file (manifest.json). This manifest contains the following definitions:

  • Overview of extensions
  • File name that is the entry point
  • life cycle
  • Extension points for UI, events, and commands
{
"name": "MyExtension", //Please specify a unique name to distinguish the extension.
"main": "MyExtension.dll", //Specify the DLL file name where the extension (IExtension implementation class) is implemented.
"lifecycle": "application", //"application", for extensions that are valid from application start to end

"extensionPoints": {
...
}
}
  • When you create a project with the project template, a manifest file with the DLL file name etc. set in advance is automatically created.
  • If you created the project manually, follow the steps below to create the manifest file.
    1. In Visual Studio Solution Explorer, add the JSON file as a new item to your project and name it manifest.json. Use UTF-8 as the character code of the manifest file.
    2. Select manifest.json in Solution Explorer and set the property Copy to Output Directory to Always Copy to make it copy at build time.
    3. Define the contents of the manifest file.
      • Specify a unique name for all extensions in name. Definitions such as MyCompany.MyExtension make it less likely to collide.
      • For main, specify the DLL file name in which the extension (IExtension implementation class) is implemented.
      • For lifecycle, specify project if the extension targets a specific project, and specify application otherwise.

For more information on manifests, see Manifest Reference.

Prepare a locale file (optional)

  • If the extension is multilingual, define a locale file named locale. {Lang} .json for each localized language.
  • For more information on multilingual support, see Multilingual.