Skip to content

Instantly share code, notes, and snippets.

@nikneem
Created February 16, 2025 23:09
Show Gist options
  • Select an option

  • Save nikneem/fe1cde2c92795dff13ae2ab15494b719 to your computer and use it in GitHub Desktop.

Select an option

Save nikneem/fe1cde2c92795dff13ae2ab15494b719 to your computer and use it in GitHub Desktop.
using Aspire.Hosting.Dapr;
using System.Collections.Immutable;
var builder = DistributedApplication.CreateBuilder(args);
var daprComponentsFolder = new DirectoryInfo(Path.Combine( Directory.GetCurrentDirectory(), "..\\..\\dapr\\components"));
if (!daprComponentsFolder.Exists)
{
throw new DirectoryNotFoundException($"Dapr components folder not found at {daprComponentsFolder.FullName}");
}
builder.AddDapr();
var options = new DaprSidecarOptions
{
ResourcesPaths = ImmutableHashSet.Create(daprComponentsFolder.FullName)
};
builder.AddProject<Projects.SDN_Demo_Sender_API>("sdn-demo-sender-api")
.WithDaprSidecar(options);
builder.AddProject<Projects.SDN_Demo_Listener_API>("sdn-demo-listener-api")
.WithDaprSidecar(options);
builder.Build().Run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment