elsa-workflows / elsa-workflows/elsa-core
Unable to install Elsa.Rebus.AzureServiceBus on .NET6 + workaround
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
We had some issues with installing **Elsa.Rebus.AzureServiceBus** package. The errors are present in the following picture:

The problem is that the package has a dependency on **Rebus.AzureServiceBus 9.0.8**. This package has dependencies on older versions of some packages. In .NET 6 those packages have newer versions. Therefore, installing that package will result in a downgrade error message.
Workaround:
We installed an older version of the **Rebus.AzureServiceBus (8.1.5)** package directly and constructed the middleware based on the one from **Elsa.Rebus.AzureServiceBus**.
The code:
```
public static ElsaOptionsBuilder AddAzureServiceBus(this ElsaOptionsBuilder options, string connectionString)
{
return options
.UseServiceBus(context =>
{
var queueName = context.QueueName;
context.Configurer
.Transport(t =>
{
if (queueName.Length > 50)
queueName = queueName.Substring(queueName.Length - 50);
t.UseNativeDeadlettering();
var transport = t.UseAzureServiceBus(connectionString, queueName);
if (context.AutoDeleteOnIdle)
transport.SetAutoDeleteOnIdle(TimeSpan.FromMinutes(5));
});
});
}
```
Contributor guide
Assessment
This issue has not been assessed yet.