Skip to content

Latest commit

 

History

History
60 lines (42 loc) · 2.08 KB

File metadata and controls

60 lines (42 loc) · 2.08 KB

Device Binding Template

The Device Binding Template provides an easy way to create device binding projects. This template is based on the .NET Templates.

How to Install

Currently, there is no NuGet package available so the template folder must be stored locally. Use the following command to install the template where PATH is the directory path the template was stored.

dotnet new -i C:\[PATH]\iot\tools\templates\DeviceBindingTemplate\dotnet_new_device-binding_csharp

The template will now show up in the New Project Dialog as of Visual Studio 2022.

NOTE: Make sure to check Place solution and project in the same directory in order for the file structure to be created correctly within the iot\src\devices directory.

image

How to Uninstall

The template can be uninstalled by using the following command where PATH is the directory path the template was stored.

dotnet new -u C:\[PATH]\iot\tools\templates\DeviceBindingTemplate\dotnet_new_device-binding_csharp

Example Device Binding

Use the following command to create a device binding project.

  • PATH is the recommended directory path where other device bindings are located in the repo structure.
  • The output parameter (-o) is not required when working in the current directory expected to create the binding project.
dotnet new device-binding -n Foo -o C:\[PATH]\iot\src\devices\Foo

The following device binding structure will be created after running the command.

iot/
  src/
    devices/
      Foo/
        Foo.cs
        Foo.csproj        
        Foo.sln
        README.md
        samples/
          Foo.Sample.cs
          Foo.Samples.csproj
        tests/   <--  Tests are optional
          Foo.Tests.csproj
          Foo.Tests.cs

Tests Project

There is a test project created when the device binding project is created. The amount and number of tests that are expected will depend on the type of binding.