Dapr .NET SDK Development with Project Tye

Learn about local development with Project Tye

Project Tye

.NET Project Tye is a microservices development tool designed to make running many .NET services easy. Tye enables you to store a configuration of multiple .NET services, processes, and container images as a runnable application.

Tye is advantageous for a .NET Dapr developer because:

  • Tye has the ability to automate the dapr CLI built-in
  • Tye understands .NET’s conventions and requires almost no configuration for .NET services
  • Tye can manage the lifetime of your dependencies in containers

Pros/cons:

  • Pro: Tye can automate all of the steps described above. You no longer need to think about concepts like ports or app-ids.
  • Pro: Since Tye can also manage containers for you, you can make those part of the application definition and stop the long-running containers on your machine.

Using Tye

Follow the Tye Getting Started to install the tye CLI and create a tye.yaml for your application.

Next follow the steps in the Tye Dapr recipe to add Dapr. Make sure to specify the relative path to your components folder with components-path in tye.yaml.

Next add any additional container dependencies and add component definitions to the folder you created earlier.

You should end up with something like this:

  1. name: store-application
  2. extensions:
  3. # Configuration for dapr goes here.
  4. - name: dapr
  5. components-path: <components-path>
  6. # Services to run go here.
  7. services:
  8. # The name will be used as the app-id. For a .NET project, Tye only needs the path to the project file.
  9. - name: orders
  10. project: orders/orders.csproj
  11. - name: products
  12. project: products/products.csproj
  13. - name: store
  14. project: store/store.csproj
  15. # Containers you want to run need an image name and set of ports to expose.
  16. - name: redis
  17. image: redis
  18. bindings:
  19. - port: 6973

Checkin tye.yaml in source control wiht the application code.

You can now use tye run to launch the whole application from one terminal. When running, Tye has a dashboard at http://localhost:8000 to view application status and logs.

Next steps

Tye runs your services locally as normal .NET process. If you need to debug, then use the attach feature of your debugger to attach to one of the running processes. Since Tye is .NET aware, it has the ability to start a process suspended for startup debugging.

Tye also has an option to run your services in containers if you wish to test locally in containers.