Before starting development on the Azure IoT SDK for C# you will need to install a few frameworks and tools. Please follow the instructions within devbox_setup.
We are following the Azure SDK design specification for C#. To preserve backward compatibility, existing code will not change to follow these rules.
Using IDisposable
types:
- If the sdk implements
class A
that owns anIDisposable
resourceX
, thenA
should also beIDisposable
. In that case, resourceX
can be safely disposed whenclass A
is disposed. - The sdk should dispose any
IDisposable
resource that it creates. - The sdk should not dispose an
IDisposable
resource that is supplied by the calling application. This is because the caller might want to reuse the resource elsewhere in the application. The responsibility of disposal of caller-suppliedIDisposable
resource is on the caller. An example of such a resource would be anX509Certificate
instance that is used for authenticating our clients.
Please read and apply our coding style when proposing PRs against the Azure repository. When changing existing files, please apply changes to the entire file. Otherwise, maintain the same style.
git clone https://github.com/Azure/azure-iot-sdk-csharp.git
- Windows:
build.cmd
- Linux:
./build.sh
For more information on running more complex scenarios (like e2e or stress testing) please add the -h
argument to the build command.
During development you can use Visual Studio by loading the azureiot.sln
solution.
If you are using a different editor, you can use the dotnet
CLI to build (in Windows, Linux or OSX). Here are a few commands. For a complete list see the .NET Core CLI tools
- Build a library csproj:
dotnet build
- Run tests from a test csproj:
dotnet test
- Run an application from a csproj (e.g. a sample):
dotnet run
Our NuGet-packaged SDK can be used certain ARM32-based devices. Since the .NET SDKs are not available on this platform, you will need to cross-compile your application.
Instructions are available here: https://github.com/dotnet/core/blob/master/samples/RaspberryPiInstructions.md
Please follow the devbox-setup "Optional Setup" for Xamarin before trying to build. To build and test, run the following Jenkins script from the root of the repository:
jenkins\windows_csharp_xamarin.cmd
Before being able to run our tests, please make sure you read, modify if necessary and run the scripts within the /test/prerequisites
folders. (e.g. e2e/test/prerequisites
and iothub/service/test/prerequisites
).
The CI system will run the jenkins
scripts from the root folder. (e.g. jenkins\windows_csharp.cmd
).
Testing requires an Azure subscription and IoT Hub and Provisioning services.
The build
command will always try to produce packages and place them within bin\pkg
.
Please see build -h
for instructions on how to set up a local NuGet source and run the e2e tests against the packages instead of the .dll binaries.
Contains development instructions for building and changing the Azure IoT SDK for C#.
If you would like to develop an application using the Azure IoT SDK for C# (using pre-built binaries), please follow the dev-guide here: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-sdks
Contains the IoT Hub Device SDK source, unit-tests and samples.
This produces the Microsoft.Azure.Devices.Client
NuGet package.
- .NET MicroFramework is no longer supported in the SDK.
Contains the IoT Hub Service SDK source, unit-tests and samples.
This produces the Microsoft.Azure.Devices
NuGet package.
Contains the Provisioning Device SDK source, unit-tests and samples.
This produces the Microsoft.Azure.Devices.Provisioning.Client
NuGet package.
Contains the Provisioning Device SDK transport libraries source and unit-tests.
/http
produces the Microsoft.Azure.Devices.Provisioning.Transport.Http
NuGet package.
/amqp
produces the Microsoft.Azure.Devices.Provisioning.Transport.Amqp
NuGet package.
/mqtt
produces the Microsoft.Azure.Devices.Provisioning.Transport.Mqtt
NuGet package.
Contains the Provisioning Service SDK source, unit-tests and samples.
This produces the Microsoft.Azure.Devices.Provisioning.Service
NuGet package.
Contains the SecurityProvider components for Hardware Security Modules.
/tpm
produces the Microsoft.Azure.Devices.Provisioning.Security.Tpm
NuGet package.
This contains public API shared across the SDK components.
This produces the Microsoft.Azure.Devices.Shared
NuGet package.
Contains common code shared between multiple components. This doesn't generate a separate library and instead may get built-in more than one library.
/test
contains end-to-end tests run before each PR integration by our internal CI system.
/stress
contains SDK stress-test applications.
Contains scripts used by our internal Continuous Integration system (Azure DevOps).
/CaptureLogs
contains scripts for capturing SDK traces.