You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Run a .NET OrchardCore application on Arm and x86
2
+
title: Configure and run an architecture-agnostic OrchardCore app on Arm and x86 using .NET AnyCPU
3
3
weight: 4
4
4
5
5
### FIXED, DO NOT MODIFY
@@ -8,29 +8,35 @@ layout: learningpathall
8
8
9
9
## Run a .NET OrchardCore application on Arm and x86
10
10
11
-
In this section, you will learn how to configure and run your OrchardCore application on both Arm and x86 architectures using the .NET AnyCPU configuration. This approach allows your application to be architecture-agnostic, enabling easier deployment across different hardware platforms.
11
+
In this section, you will configure and run your OrchardCore application on both Arm and x86 architectures using .NET's AnyCPU configuration. This architecture-agnostic approach simplifies deployment and ensures that your application runs smoothly on diverse hardware, including cloud VMs, local development boxes, and edge devices.
12
12
13
-
The AnyCPU feature has existed since .NET Framework 2.0, but its current behavior (particularly how it handles 32-bit vs. 64-bit execution) was defined in .NET Framework 4.5.
13
+
The AnyCPU feature has existed since .NET Framework 2.0, but its current behavior (particularly how it handles 32-bit vs. 64-bit execution) was defined in .NET Framework 4.5.
14
+
15
+
{{% notice Note %}}
16
+
In .NET Core and .NET 5+, AnyCPU still lets the runtime decide which architecture to use, but keep in mind that your build must match the runtime environment's bitness (32-bit vs. 64-bit). Since .NET 8 targets 64-bit by default, this Learning Path assumes 64-bit runtime environments on both Arm64 and x86_64.
17
+
{{% /notice %}}
14
18
15
19
## Configure the project for AnyCPU
16
20
17
-
To make your OrchardCore application architecture-agnostic, you need to configure it to use the AnyCPU platform target. This allows the .NET runtime to choose the appropriate architecture at runtime.
21
+
To make your OrchardCore application architecture-agnostic, configure the project to use the AnyCPU platform target. This allows the .NET runtime to select the appropriate architecture at runtime.
18
22
19
-
First, open your OrchardCore project `MyOrchardCoreApp.csproj` in your preferred IDE.
23
+
1. Open your OrchardCore project `MyOrchardCoreApp.csproj` in your IDE.
20
24
21
-
Next, find the `<PropertyGroup>` and add the `<PlatformTarget>` element to `AnyCPU`:
25
+
2. Add the `<PlatformTarget>` element to your existing `<PropertyGroup>`:
22
26
23
27
```xml
24
28
<PropertyGroup>
25
29
<PlatformTarget>AnyCPU</PlatformTarget>
26
30
</PropertyGroup>
27
31
```
28
32
29
-
Save the `.csproj` file:
33
+
3. Save the `.csproj` file.
34
+
35
+
## Build and run on any platform
30
36
31
-
## Build once, run anywhere
37
+
You can now build your application once and run it on either an x86_64 or Arm64 system.
32
38
33
-
You can now build your application on either an x86 or Arm host machine and deploy it on any architecture:
0 commit comments