elsa-workflows / elsa-workflows/elsa-core

Unable to install Elsa.Rebus.AzureServiceBus on .NET6 + workaround

Open
#3,183 1 comment 0 reactions 0 assignees View on GitHub
documentation triaged
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:

![image](https://user-images.githubusercontent.com/96233009/177518524-93b45bef-377f-4930-a911-6e841c8a79d9.png)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.