Skip to content

Commit cc912e1

Browse files
committed
Add warning about PublishAot
1 parent 5c8a25d commit cc912e1

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

articles/getting_started/packaging_games.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ From the .NET CLI:
1515

1616
`dotnet publish -c Release -r win-x64 -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishAot=true --self-contained`
1717

18+
> [!IMPORTANT]
19+
> Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
20+
1821
You can then zip the content of the publish folder and distribute the archive as-is.
1922

2023
If you are targeting WindowsDX, note that players will need [the DirectX June 2010 runtime](https://www.microsoft.com/en-us/download/details.aspx?id=8109) to be installed on their machine for audio and gamepads to work properly.
@@ -48,8 +51,8 @@ dotnet publish -c Release -r osx-x64 -p:PublishReadyToRun=false -p:TieredCompila
4851
dotnet publish -c Release -r osx-arm64 -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishAot=true --self-contained
4952
```
5053

51-
Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code.
52-
Especially if you are using Reflection.
54+
> [!IMPORTANT]
55+
> Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
5356
5457
Next we need to comibne the two binaries into one Universal Binary which will work on both arm64 and x64 machines.
5558
We can do this using the `xcode` utility `lipo`.
@@ -141,6 +144,9 @@ From the .NET CLI:
141144

142145
`dotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=false -p:TieredCompilation=false -p:PublishAot=true --self-contained`
143146

147+
> [!IMPORTANT]
148+
> Note we are making use of the `PublishAot` option. Using `Aot` has some restrictions which may require changes to your game code. Especially if you are using Reflection.
149+
144150
You can then archive the content of the publish folder and distribute the archive as-is.
145151

146152
We recommend using the .tar.gz archiving format to preserve the execution permissions.
@@ -164,16 +170,18 @@ However you do need to currently add some additional settings to your .csproj.
164170
```
165171

166172
The `TrimmerRootAssembly` stops the trimmer removing code from these assemblies. This will on the whole allow the game to run without
167-
any issues. However if you are using any Third Party or additional assemblies, you might need to add them to this list.
168-
For MacOS it is recommended that you publish using AOT as it simplifies the app bundle.
173+
any issues. However if you are using any Third Party or additional assemblies, you might need to add them to this list or fix your code to be `Aot` compliant.
174+
It is recommended that you publish using AOT as it simplifies the app bundle.
169175

170176
See [Trim self-contained deployments and executables](https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trim-self-contained) for more information.
171177

172-
There are some known area's yoo need to watchout for.
178+
There are some known area's you need to watchout for.
173179

174180
1. Using `XmlSerializer` in your game will probably cause issues. Since it uses reflection it will be difficult for the Trimmer to figure out what needs to be kept.
175181
It is recommended that instead of using the `Deserialize` method, you write your own custom deserializer using `XDocument` or `XmlReader`.
176-
Alternatively you can use the Content Pipeline and create a custom `Processor` and `Reader` to convert the Xml into a binary format that can be loaded via the usual `Content.Load<T>` method.
182+
Alternatively you can use the Content Pipeline and create a custom `Processor` and `Reader` to convert the Xml into a binary format that can be loaded via the usual `Content.Load<T>` method.
183+
2. Dynamically loading assemblies via `Assembly.LoadFile`.
184+
3. No run-time code generation, for example, System.Reflection.Emit.
177185

178186
### ReadyToRun (R2R)
179187

0 commit comments

Comments
 (0)