Skip to content

Commit 5beb4bd

Browse files
committed
draft
1 parent a31f3c2 commit 5beb4bd

File tree

4 files changed

+91
-24
lines changed

4 files changed

+91
-24
lines changed

docs/core/tools/sdk-errors/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ f1_keywords:
2929
- NETSDK1029
3030
- NETSDK1030
3131
- NETSDK1031
32-
- NETSDK1032
3332
- NETSDK1042
3433
- NETSDK1043
3534
- NETSDK1044
@@ -110,7 +109,6 @@ f1_keywords:
110109
- NETSDK1140
111110
- NETSDK1142
112111
- NETSDK1143
113-
- NETSDK1144
114112
- NETSDK1146
115113
- NETSDK1148
116114
- NETSDK1150
@@ -208,7 +206,7 @@ This list is a complete list of the errors that you might get from the .NET SDK
208206
|NETSDK1029|Unable to use '{0}' as application host executable as it does not contain the expected placeholder byte sequence '{1}' that would mark where the application name would be written.|
209207
|NETSDK1030|Given file name '{0}' is longer than 1024 bytes.|
210208
|NETSDK1031|It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false.|
211-
|NETSDK1032|The RuntimeIdentifier platform '{0}' and the PlatformTarget '{1}' must be compatible.|
209+
|[NETSDK1032](netsdk1032.md)|The RuntimeIdentifier platform '{0}' and the PlatformTarget '{1}' must be compatible.|
212210
|NETSDK1042|Could not load PlatformManifest from '{0}' because it did not exist.|
213211
|NETSDK1043|Error parsing PlatformManifest from '{0}' line {1}. Lines must have the format {2}.|
214212
|NETSDK1044|Error parsing PlatformManifest from '{0}' line {1}. {2} '{3}' was invalid.|
@@ -307,7 +305,7 @@ This list is a complete list of the errors that you might get from the .NET SDK
307305
|[NETSDK1141](netsdk1141.md)|Unable to resolve the .NET SDK version as specified in the global.json located at {0}.|
308306
|NETSDK1142|Including symbols in a single file bundle is not supported when publishing for .NET5 or higher.|
309307
|NETSDK1143|Including all content in a single file bundle also includes native libraries. If IncludeAllContentForSelfExtract is true, IncludeNativeLibrariesForSelfExtract must not be false.|
310-
|NETSDK1144|Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.|
308+
|[NETSDK1144](netsdk1144.md)|Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.|
311309
|[NETSDK1145](netsdk1145.md)|The {0} pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if it specifies a certain SDK version, and uninstall the newer SDK. For more options visit <https://aka.ms/targeting-apphost-pack-missing>. Pack Type:{0}, Pack directory: {1}, targetframework: {2}, Pack PackageId: {3}, Pack Package Version: {4}.|
312310
|NETSDK1146|PackAsTool does not support TargetPlatformIdentifier being set. For example, TargetFramework cannot be net5.0-windows, only net5.0. PackAsTool also does not support UseWPF or UseWindowsForms when targeting .NET 5 and higher.|
313311
|[NETSDK1147](netsdk1147.md)|To build this project, the following workloads must be installed: {0}.|
Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,66 @@
11
---
2-
title: "NETSDK1144: Optimizing assemblies for size failed"
3-
description: How to resolve the optimizing for size failed message.
2+
title: "NETSDK1032: RuntimeIdentifier and PlatformTarget must be compatible."
3+
description: How to resolve the NETSDK1032 error 'RuntimeIdentifier and PlatformTarget must be compatible.'
44
author: tdykstra
55
ms.topic: error-reference
66
ms.date: 01/14/2025
7+
ai-usage: ai-assisted
78
f1_keywords:
8-
- NETSDK1144
9+
- NETSDK1032
910
---
10-
# NETSDK1144: Duplicate items were included
11+
# NETSDK1032: RuntimeIdentifier and PlatformTarget must be compatible
1112

12-
**This article applies to:** ✔️ .NET Core 2.1.100 SDK and later versions
13+
The error `NETSDK1032` occurs when there is a mismatch between the `RuntimeIdentifier` (RID), such as `win-x64` or `linux-x64`, and the `PlatformTarget`, such as `x64` or `x86`. The full error message is similar to the following example:
1314

14-
## Causes of .NET Build Error Code NETSDK1144
15+
> The `RuntimeIdentifier` platform '{RID}' and the `PlatformTarget` '{Target}' must be compatible.
1516
16-
One cause of error code `NETSDK1144` is a `UseAppHost` property set to `true` in a project that targets a runtime identifier (RID) that does not support an application host. This typically happens when building a project for a platform that doesn't support generating an executable host.
17+
The RID is specified in the project file or passed into the build process from the command line. If not specified, the default RID used is `win-x64` for Windows, `linux-x64` for Linux, and `osx-x64` for macOS.
1718

18-
## How to Fix NETSDK1144 Errors
19+
The `PlatformTarget` is specified in the project file or passed into the build process from the command line. If not specified, the default is `AnyCPU`. With `PlatformTarget` set to `AnyCPU`, the application can run on both 32-bit and 64-bit platforms. The runtime executes the app as 64-bit if the OS is 64-bit, and as 32-bit for a 32-bit OSif the OS is 32-bit.
1920

20-
1. Check the Target Runtime Identifier (RID):
21-
- Ensure that the RID specified in your project file is correct and supported for generating an application host.
22-
- Some common RIDs are `win-x64`, `linux-x64`, `osx-x64`.
21+
Here's an example of a `.csproj` file with incompatible RID and `PlatformTarget` settings (x86 and x64):
2322

24-
2. Modify the `UseAppHost` Property or remove unsupported RIDs:
25-
- If the target RID does not support an application host, set the `UseAppHost` property to `false` in your project file.
26-
- If you're targeting multiple RIDs, remove any that don't support generating an application host.
23+
```xml
24+
<Project Sdk="Microsoft.NET.Sdk">
2725

28-
## Example Fix
26+
<PropertyGroup>
27+
<OutputType>Exe</OutputType>
28+
<TargetFramework>net8.0</TargetFramework>
29+
<PlatformTarget>x86</PlatformTarget>
30+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
31+
</PropertyGroup>
2932

30-
Here is an example of a `.csproj` file with the `UseAppHost` property set to `false`:
33+
</Project>
34+
```
35+
36+
Fix this error by changing either `PlatformTarget` or `RuntimeIdentifier`. For example:
3137

3238
```xml
3339
<Project Sdk="Microsoft.NET.Sdk">
3440

3541
<PropertyGroup>
3642
<OutputType>Exe</OutputType>
37-
<TargetFramework>net6.0</TargetFramework>
38-
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
39-
<UseAppHost>false</UseAppHost>
43+
<TargetFramework>net8.0</TargetFramework>
44+
<!-- Change the PlatformTarget to match the RID. -->
45+
<PlatformTarget>x64</PlatformTarget>
46+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
4047
</PropertyGroup>
4148

4249
</Project>
4350
```
4451

45-
In this example, the `UseAppHost` property is set to `false` because the `linux-arm` RID does not support generating an application host.
52+
Or:
53+
54+
```xml
55+
<Project Sdk="Microsoft.NET.Sdk">
56+
57+
<PropertyGroup>
58+
<OutputType>Exe</OutputType>
59+
<TargetFramework>net8.0</TargetFramework>
60+
<PlatformTarget>x86</PlatformTarget>
61+
<!-- Change the RID to match the PlatformTarget. -->
62+
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
63+
</PropertyGroup>
64+
65+
</Project>
66+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "NETSDK1144: Optimizing assemblies for size failed"
3+
description: How to resolve the 'optimizing for size failed' message.
4+
author: tdykstra
5+
ms.topic: error-reference
6+
ms.date: 01/14/2025
7+
ai-usage: ai-assisted
8+
f1_keywords:
9+
- NETSDK1144
10+
---
11+
# NETSDK1144: Optimizing assemblies for size failed
12+
13+
## Error Message
14+
15+
The error `NETSDK1144` is reported when an error occurs in the trimming process. The full error message is similar to the following example:
16+
17+
> Optimizing assemblies for size failed. Optimization can be disabled by setting the `PublishTrimmed` property to false.
18+
19+
Set the `PublishTrimmed` property to `false` in the project file or the command line:
20+
21+
```xml
22+
<PropertyGroup>
23+
<PublishTrimmed>false</PublishTrimmed>
24+
</PropertyGroup>
25+
```
26+
27+
```dotnetcli
28+
dotnet publish /p:PublishTrimmed=false
29+
```
30+
31+
Here's an example of a `.csproj` file with trimming disabled:
32+
33+
```xml
34+
<Project Sdk="Microsoft.NET.Sdk">
35+
36+
<PropertyGroup>
37+
<OutputType>Exe</OutputType>
38+
<TargetFramework>net8.0</TargetFramework>
39+
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
40+
<PublishTrimmed>false</PublishTrimmed>
41+
</PropertyGroup>
42+
43+
</Project>
44+
```

docs/navigate/tools-diagnostics/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ items:
3333
href: ../../core/tools/sdk-errors/netsdk1013.md
3434
- name: NETSDK1022
3535
href: ../../core/tools/sdk-errors/netsdk1022.md
36+
- name: NETSDK1032
37+
href: ../../core/tools/sdk-errors/netsdk1032.md
3638
- name: NETSDK1045
3739
href: ../../core/tools/sdk-errors/netsdk1045.md
3840
- name: NETSDK1059
@@ -67,6 +69,8 @@ items:
6769
href: ../../core/tools/sdk-errors/netsdk1138.md
6870
- name: NETSDK1141
6971
href: ../../core/tools/sdk-errors/netsdk1141.md
72+
- name: NETSDK1144
73+
href: ../../core/tools/sdk-errors/netsdk1144.md
7074
- name: NETSDK1145
7175
href: ../../core/tools/sdk-errors/netsdk1145.md
7276
- name: NETSDK1147

0 commit comments

Comments
 (0)