Skip to content

Commit 3c4b8ca

Browse files
authored
Document NETSDK1032 and NETSDK1144 (#44452)
1 parent 4571665 commit 3c4b8ca

File tree

4 files changed

+106
-4
lines changed

4 files changed

+106
-4
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: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: "NETSDK1032: RuntimeIdentifier and PlatformTarget must be compatible."
3+
description: How to resolve the NETSDK1032 error 'RuntimeIdentifier and PlatformTarget must be compatible.'
4+
author: tdykstra
5+
ms.topic: error-reference
6+
ms.date: 01/14/2025
7+
ai-usage: ai-assisted
8+
f1_keywords:
9+
- NETSDK1032
10+
---
11+
# NETSDK1032: RuntimeIdentifier and PlatformTarget must be compatible
12+
13+
The error `NETSDK1032` occurs when there's 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:
14+
15+
> The `RuntimeIdentifier` platform '{RID}' and the `PlatformTarget` '{Target}' must be compatible.
16+
17+
The RID is specified in the project file or the command line. If not specified, the default RID used is `win-x64` for Windows, `linux-x64` for Linux, and `osx-x64` for macOS.
18+
19+
The `PlatformTarget` is specified in the project file or the command line. If not specified, the default is `AnyCPU`.
20+
21+
Here's an example of a `.csproj` file with incompatible RID and `PlatformTarget` settings:
22+
23+
```xml
24+
<Project Sdk="Microsoft.NET.Sdk">
25+
<PropertyGroup>
26+
<OutputType>Exe</OutputType>
27+
<TargetFramework>net8.0</TargetFramework>
28+
<PlatformTarget>x86</PlatformTarget>
29+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
30+
</PropertyGroup>
31+
</Project>
32+
```
33+
34+
Fix the preceding `.csproj` file by changing either `PlatformTarget` or `RuntimeIdentifier`. For example, change `PlatformTarget` to match the RID:
35+
36+
```xml
37+
<Project Sdk="Microsoft.NET.Sdk">
38+
<PropertyGroup>
39+
<OutputType>Exe</OutputType>
40+
<TargetFramework>net8.0</TargetFramework>
41+
<PlatformTarget>x64</PlatformTarget>
42+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
43+
</PropertyGroup>
44+
</Project>
45+
```
46+
47+
Or change the RID to match the `PlatformTarget`:
48+
49+
```xml
50+
<Project Sdk="Microsoft.NET.Sdk">
51+
<PropertyGroup>
52+
<OutputType>Exe</OutputType>
53+
<TargetFramework>net8.0</TargetFramework>
54+
<PlatformTarget>x86</PlatformTarget>
55+
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
56+
</PropertyGroup>
57+
</Project>
58+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
To disable trimming, 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+
<PropertyGroup>
36+
<OutputType>Exe</OutputType>
37+
<TargetFramework>net8.0</TargetFramework>
38+
<RuntimeIdentifier>linux-arm</RuntimeIdentifier>
39+
<PublishTrimmed>false</PublishTrimmed>
40+
</PropertyGroup>
41+
</Project>
42+
```

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)