-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #545 from Particular/support-net9
Updates for .NET 9
- Loading branch information
Showing
32 changed files
with
169 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
- name: Setup .NET SDK | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 8.0.x | ||
dotnet-version: 9.0.x | ||
- name: Build | ||
run: dotnet build src --configuration Release | ||
- name: Upload packages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
- name: Setup .NET SDK | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 8.0.x | ||
dotnet-version: 9.0.x | ||
- name: Build | ||
run: dotnet build src --configuration Release | ||
- name: Sign NuGet packages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"sdk": { | ||
"version": "8.0.400", | ||
"version": "9.0.100", | ||
"rollForward": "latestFeature" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
src/Tests/ApprovalFiles/TemplateTests.NServiceBusEndpointTargetFramework.net9.0.approved.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
--------------------------------------------------------------- | ||
NServiceBusEndpointTargetFrameworknet9.0.csproj | ||
--------------------------------------------------------------- | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Wildcards are used in PackageReferences below to ensure projects created from the template reference the latest versions of packages. | ||
Consider changing the wildcard versions to explicit versions to have more control over which versions are being used. | ||
--> | ||
<ItemGroup> | ||
<PackageReference Include="NServiceBus" Version="(VERSION)" /> | ||
<PackageReference Include="NServiceBus.Extensions.Hosting" Version="(VERSION)" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="appsettings*.json" CopyToOutputDirectory="PreserveNewest" /> | ||
<None Remove="appsettings*.json" /> | ||
<ProjectCapability Include="DynamicFileNestingEnabled" /> | ||
</ItemGroup> | ||
|
||
</Project> | ||
--------------------------------------------------------------- | ||
Program.cs | ||
--------------------------------------------------------------- | ||
using Microsoft.Extensions.Hosting; | ||
|
||
var builder = Host.CreateApplicationBuilder(args); | ||
|
||
// TODO: consider moving common endpoint configuration into a shared project | ||
// for use by all endpoints in the system | ||
|
||
var endpointConfiguration = new EndpointConfiguration("NServiceBusEndpointTargetFrameworknet9._0"); | ||
|
||
// Learning Transport: https://docs.particular.net/transports/learning/ | ||
var routing = endpointConfiguration.UseTransport(new LearningTransport()); | ||
|
||
// Define routing for commands: https://docs.particular.net/nservicebus/messaging/routing#command-routing | ||
// routing.RouteToEndpoint(typeof(MessageType), "DestinationEndpointForType"); | ||
// routing.RouteToEndpoint(typeof(MessageType).Assembly, "DestinationForAllCommandsInAssembly"); | ||
|
||
// Learning Persistence: https://docs.particular.net/persistence/learning/ | ||
endpointConfiguration.UsePersistence<LearningPersistence>(); | ||
|
||
// Message serialization | ||
endpointConfiguration.UseSerialization<SystemJsonSerializer>(); | ||
|
||
endpointConfiguration.DefineCriticalErrorAction(OnCriticalError); | ||
|
||
// Installers are useful in development. Consider disabling in production. | ||
// https://docs.particular.net/nservicebus/operations/installers | ||
endpointConfiguration.EnableInstallers(); | ||
|
||
builder.UseNServiceBus(endpointConfiguration); | ||
|
||
var app = builder.Build(); | ||
app.Run(); | ||
|
||
static async Task OnCriticalError(ICriticalErrorContext context, CancellationToken cancellationToken) | ||
{ | ||
// TODO: decide if stopping the endpoint and exiting the process is the best response to a critical error | ||
// https://docs.particular.net/nservicebus/hosting/critical-errors | ||
// and consider setting up service recovery | ||
// https://docs.particular.net/nservicebus/hosting/windows-service#installation-restart-recovery | ||
try | ||
{ | ||
await context.Stop(cancellationToken); | ||
} | ||
finally | ||
{ | ||
FailFast($"Critical error, shutting down: {context.Error}", context.Exception); | ||
} | ||
} | ||
|
||
static void FailFast(string message, Exception exception) | ||
{ | ||
try | ||
{ | ||
// TODO: decide what kind of last resort logging is necessary | ||
// TODO: when using an external logging framework it is important to flush any pending entries prior to calling FailFast | ||
// https://docs.particular.net/nservicebus/hosting/critical-errors#when-to-override-the-default-critical-error-action | ||
} | ||
finally | ||
{ | ||
Environment.FailFast(message, exception); | ||
} | ||
} | ||
|
||
--------------------------------------------------------------- | ||
launchSettings.json | ||
--------------------------------------------------------------- | ||
{ | ||
"$schema": "http://json.schemastore.org/launchsettings.json", | ||
"profiles": { | ||
"NServiceBusEndpointTargetFrameworknet9._0": { | ||
"commandName": "Project", | ||
"dotnetRunMessages": true, | ||
"environmentVariables": { | ||
"DOTNET_ENVIRONMENT": "Development" | ||
} | ||
} | ||
} | ||
} | ||
|
||
--------------------------------------------------------------- | ||
appsettings.Development.json | ||
--------------------------------------------------------------- | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
} | ||
} | ||
|
||
--------------------------------------------------------------- | ||
appsettings.json | ||
--------------------------------------------------------------- | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.Hosting.Lifetime": "Information" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.