Skip to content

Commit 42a1694

Browse files
committed
formatting fixes
1 parent 919d378 commit 42a1694

File tree

4 files changed

+73
-75
lines changed

4 files changed

+73
-75
lines changed

content/learning-paths/servers-and-cloud-computing/dotnet-migration/1-create-orchardcore-app.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ sudo apt-get install -y dotnet-sdk-8.0
2525

2626
3. **Verify installations**:
2727

28-
```bash
29-
dotnet --version
30-
```
28+
```bash
29+
dotnet --version
30+
```
3131

3232
## Step 2: Install the OrchardCore Templates
3333

@@ -43,31 +43,31 @@ This command installs the OrchardCore project templates, which you will use to c
4343

4444
1. **Create a new project**: Use the `dotnet` CLI to create a new OrchardCore application.
4545

46-
```bash
47-
dotnet new occms -n MyOrchardCoreApp
48-
```
46+
```bash
47+
dotnet new occms -n MyOrchardCoreApp
48+
```
4949

5050
This command creates a new OrchardCore CMS application in a directory named `MyOrchardCoreApp`.
5151

5252
2. **Navigate to the project directory**:
5353

54-
```bash
55-
cd MyOrchardCoreApp
56-
```
54+
```bash
55+
cd MyOrchardCoreApp
56+
```
5757

5858
## Step 4: Run the OrchardCore application
5959

6060
1. **Build the application**: Compile the application using the following command:
6161

62-
```bash
63-
dotnet build
64-
```
62+
```bash
63+
dotnet build
64+
```
6565

6666
2. **Run the application**: Start the application with:
6767

68-
```bash
69-
dotnet run --urls http://0.0.0.0:8080
70-
```
68+
```bash
69+
dotnet run --urls http://0.0.0.0:8080
70+
```
7171

7272
3. **Access the application**: Open a web browser and navigate to `http://[instance IP]:8080` to see your OrchardCore application in action, where `[instance IP]` is the public IP of your Azure Cobalt instance.
7373

content/learning-paths/servers-and-cloud-computing/dotnet-migration/2-add-shared-c-library.md

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ First, you need to create a simple C shared library. This library will contain a
1717

1818
1. Create a new file named `mylib.c` with the following content:
1919

20-
```c
21-
#include <stdio.h>
20+
```c
21+
#include <stdio.h>
2222

23-
void greet() {
24-
printf("Hello from the C library!\n");
25-
}
26-
```
23+
void greet() {
24+
printf("Hello from the C library!\n");
25+
}
26+
```
2727

2828
2. Compile the C file into a shared library:
2929

30-
```bash
31-
gcc -shared -o libmylib.so -fPIC mylib.c
32-
```
30+
```bash
31+
gcc -shared -o libmylib.so -fPIC mylib.c
32+
```
3333

3434
This will generate a shared library file (`libmylib.so`).
3535

@@ -39,54 +39,54 @@ Now that you have a shared library, you can use it in your .NET application.
3939

4040
1. In your OrchardCore application, create a new class file named `NativeMethods.cs`:
4141

42-
```csharp
43-
using System;
44-
using System.Runtime.InteropServices;
42+
```csharp
43+
using System;
44+
using System.Runtime.InteropServices;
4545

46-
public static class NativeMethods
47-
{
48-
[DllImport("mylib", EntryPoint = "greet")]
49-
public static extern void Greet();
50-
}
51-
```
46+
public static class NativeMethods
47+
{
48+
[DllImport("mylib", EntryPoint = "greet")]
49+
public static extern void Greet();
50+
}
51+
```
5252

5353
2. Call the `Greet` method from your application. For example, you can add the following code to your main program or a controller:
5454

55-
```csharp
56-
using OrchardCore.Logging;
55+
```csharp
56+
using OrchardCore.Logging;
5757

58-
var builder = WebApplication.CreateBuilder(args);
58+
var builder = WebApplication.CreateBuilder(args);
5959

60-
builder.Host.UseNLogHost();
60+
builder.Host.UseNLogHost();
6161

62-
builder.Services
63-
.AddOrchardCms()
64-
// // Orchard Specific Pipeline
65-
// .ConfigureServices( services => {
66-
// })
67-
// .Configure( (app, routes, services) => {
68-
// })
69-
;
62+
builder.Services
63+
.AddOrchardCms()
64+
// // Orchard Specific Pipeline
65+
// .ConfigureServices( services => {
66+
// })
67+
// .Configure( (app, routes, services) => {
68+
// })
69+
;
7070

71-
var app = builder.Build();
71+
var app = builder.Build();
7272

73-
Console.WriteLine("Calling native greet..."); // NEW INTEROP LINE
74-
NativeMethods.Greet(); // NEW INTEROP LINE
73+
Console.WriteLine("Calling native greet..."); // NEW INTEROP LINE
74+
NativeMethods.Greet(); // NEW INTEROP LINE
7575
76-
if (!app.Environment.IsDevelopment())
77-
{
78-
app.UseExceptionHandler("/Error");
79-
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
80-
app.UseHsts();
81-
}
76+
if (!app.Environment.IsDevelopment())
77+
{
78+
app.UseExceptionHandler("/Error");
79+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
80+
app.UseHsts();
81+
}
8282

83-
app.UseHttpsRedirection();
84-
app.UseStaticFiles();
83+
app.UseHttpsRedirection();
84+
app.UseStaticFiles();
8585

86-
app.UseOrchardCore();
86+
app.UseOrchardCore();
8787

88-
app.Run();
89-
```
88+
app.Run();
89+
```
9090

9191
3. Ensure that dotnet can find your shared library:
9292

@@ -115,4 +115,4 @@ aarch64-linux-gnu-gcc -mcpu=neoverse-n2 -O3 -shared -o libmylib.so -fPIC mylib.c
115115

116116
The `-mcpu=neoverse-n2` flag specifies the Cobalt architecture, and `-O3` ensures that maximum optimizations are completed (including SIMD opimizations).
117117

118-
In the next section, you will explore the tradeoffs of building native AOT arm64 binaries.
118+
In the next section, you will explore how to make your build architecture agnostic with the anyCPU feature.

content/learning-paths/servers-and-cloud-computing/dotnet-migration/3-any-cpu.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,25 @@ To make your OrchardCore application architecture agnostic, you need to configur
2020
2. Locate the `.csproj` file for your project.
2121
3. Modify the `<PlatformTarget>` element to `AnyCPU`:
2222

23-
```xml
24-
<PropertyGroup>
25-
<PlatformTarget>AnyCPU</PlatformTarget>
26-
</PropertyGroup>
27-
```
23+
```xml
24+
<PropertyGroup>
25+
<PlatformTarget>AnyCPU</PlatformTarget>
26+
</PropertyGroup>
27+
```
2828

2929
4. Save the changes to the `.csproj` file.
3030

3131
## Build once, run anywhere
3232

33-
```bash
34-
dotnet build -c Release
35-
```
33+
```bash
34+
dotnet build -c Release
35+
```
3636

3737
4. Run the application:
3838

39-
```bash
40-
dotnet run --urls http://0.0.0.0:8080
41-
```
39+
```bash
40+
dotnet run --urls http://0.0.0.0:8080
41+
```
4242

4343
Your application should now be runnable on any architecture. All you have to do is copy the `MyOrchardCoreApp` directory to any computer with the .NET 8 Framework installed and run
4444

content/learning-paths/servers-and-cloud-computing/dotnet-migration/_index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ who_is_this_for: .NET developers who want to take advantage of the cost and perf
88
learning_objectives:
99
- Create and compile a basic OrchardCore CMS application
1010
- Add a simple C shared library to your .NET application
11-
- Understand the tradeoffs of building native AOT (ahead-of-time) arm64 binaries
12-
- Learn about TieredPGO (Profile Guided Optimization) for .NET
11+
- Learn about anyCPU hardware agnostic builds
1312
- Gain intuition about performance of different .NET versions
14-
- .NET optimizations for huge core counts
1513

1614
prerequisites:
1715
- An Azure account
18-
- Installation of .NET 10
16+
- Installation of .NET 8
1917
- gcc installed
2018

2119
author: Joe Stech

0 commit comments

Comments
 (0)