|
| 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 | +f1_keywords: |
| 8 | +- NETSDK1144 |
| 9 | +--- |
| 10 | +# NETSDK1144: Duplicate items were included |
| 11 | + |
| 12 | +**This article applies to:** ✔️ .NET Core 2.1.100 SDK and later versions |
| 13 | + |
| 14 | +## Causes of .NET Build Error Code NETSDK1144 |
| 15 | + |
| 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 | + |
| 18 | +## How to Fix NETSDK1144 Errors |
| 19 | + |
| 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`. |
| 23 | + |
| 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. |
| 27 | + |
| 28 | +## Example Fix |
| 29 | + |
| 30 | +Here is an example of a `.csproj` file with the `UseAppHost` property set to `false`: |
| 31 | + |
| 32 | +```xml |
| 33 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 34 | + |
| 35 | + <PropertyGroup> |
| 36 | + <OutputType>Exe</OutputType> |
| 37 | + <TargetFramework>net6.0</TargetFramework> |
| 38 | + <RuntimeIdentifier>linux-arm</RuntimeIdentifier> |
| 39 | + <UseAppHost>false</UseAppHost> |
| 40 | + </PropertyGroup> |
| 41 | + |
| 42 | +</Project> |
| 43 | +``` |
| 44 | + |
| 45 | +In this example, the `UseAppHost` property is set to `false` because the `linux-arm` RID does not support generating an application host. |
0 commit comments