This is part of the NServiceBus Upgrade Guide from Version 7 to 8, which also includes the following individual upgrade guides for specific components:
- Upgrading the data bus from version 7 to 8
- Dependency Injection changes
- Upgrade NServiceBus downstreams from Version 7 to 8
- Upgrading message contracts from Version 7 to 8
- Upgrade NServiceBus pipeline extensions from Version 7 to 8
- Transport configuration changes
- Upgrade AmazonSQS Transport Version 5 to 6
- Azure Service Bus Transport Upgrade Version 2 to 3
- Azure Storage Queues Transport Upgrade Version 10 to 11
- MSMQ Transport Upgrade Version 1 to 2
- RabbitMQ Transport Upgrade Version 7 to 8
- SQL Server Transport Upgrade Version 6 to 7
NServiceBus version 8 does not support .NET Standard as a target framework. Therefore, message contract assemblies that target
netstandard2. and reference NServiceBus must be updated. This guide shows possible approaches. General guidance is available in the sharing message contracts documentation.
Change to specific target Framework
If all endpoints share the same target framework (e.g., .NET Core 3.1), the message contracts assembly can be changed from targeting .NET Standard to the same target framework as the endpoint projects.
If endpoints sharing a common contracts assembly target different platforms and frameworks (e.g. both .NET Framework 4.8 and .NET Core 6.0), the target assembly can use multi-targeting by replacing the
TargetFramwork element with the
TargetFrameworks (note the plural) element in the
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <!-- Typically, it is sufficient to list the lowest version needed --> <TargetFrameworks>net48;net6.0</TargetFrameworks> </PropertyGroup> </Project>
For further information and assistance, refer to the support channels.