Skip to content

Document selected NETSDK error messages #30145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 20, 2022
16 changes: 8 additions & 8 deletions docs/core/tools/sdk-errors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ This is a complete list of the errors that you might get from the .NET SDK while
|[NETSDK1079](netsdk1079.md)|The Microsoft.AspNetCore.All package is not supported when targeting .NET Core 3.0 or higher. A FrameworkReference to Microsoft.AspNetCore.App should be used instead, and will be implicitly included by Microsoft.NET.Sdk.Web.|
|[NETSDK1080](netsdk1080.md)|A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference.|
|NETSDK1081|The targeting pack for {0} was not found. You may be able to resolve this by running a NuGet restore on the project.|
|NETSDK1082|There was no runtime pack for {0} available for the specified RuntimeIdentifier '{1}'.|
|[NETSDK1082](netsdk1082.md)|There was no runtime pack for {0} available for the specified RuntimeIdentifier '{1}'.|
|NETSDK1083|The specified RuntimeIdentifier '{0}' is not recognized.|
|NETSDK1084|There is no application host available for the specified RuntimeIdentifier '{0}'.|
|NETSDK1085|The 'NoBuild' property was set to true but the 'Build' target was invoked.|
Expand All @@ -100,7 +100,7 @@ This is a complete list of the errors that you might get from the .NET SDK while
|NETSDK1097|It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false.|
|NETSDK1098|Applications published to a single-file are required to use the application host. You must either set PublishSingleFile to false or set UseAppHost to true.|
|NETSDK1099|Publishing to a single-file is only supported for executable applications.|
|NETSDK1100|To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true.|
|[NETSDK1100](netsdk1100.md)|To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true.|
|NETSDK1102|Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app.|
|NETSDK1103|RollForward setting is only supported on .NET Core 3.0 or higher.|
|NETSDK1104|RollForward value '{0}' is invalid. Allowed values are {1}.|
Expand All @@ -110,7 +110,7 @@ This is a complete list of the errors that you might get from the .NET SDK while
|NETSDK1109|Runtime list file '{0}' was not found. Report this error to the .NET team here: <https://aka.ms/dotnet-sdk-issue>.|
|NETSDK1110|More than one asset in the runtime pack has the same destination sub-path of '{0}'. Report this error to the .NET team here: <https://aka.ms/dotnet-sdk-issue>.|
|NETSDK1111|Failed to delete output apphost: {0}.|
|NETSDK1112|The runtime pack for {0} was not downloaded. Try running a NuGet restore with the RuntimeIdentifier '{1}'.|
|[NETSDK1112](netsdk1112.md)|The runtime pack for {0} was not downloaded. Try running a NuGet restore with the RuntimeIdentifier '{1}'.|
|NETSDK1113|Failed to create apphost (attempt {0} out of {1}): {2}.|
|NETSDK1114|Unable to find a .NET Core IJW host. The .NET Core IJW host is only available on .NET Core 3.1 or higher when targeting Windows.|
|NETSDK1115|The current .NET SDK does not support .NET Framework without using .NET SDK Defaults. It is likely due to a mismatch between C++/CLI project CLRSupport property and TargetFramework.|
Expand All @@ -133,10 +133,10 @@ This is a complete list of the errors that you might get from the .NET SDK while
|NETSDK1132|No runtime pack information was available for {0}.|
|NETSDK1133|There was conflicting information about runtime packs available for {0}.|
|NETSDK1134|Building a solution with a specific RuntimeIdentifier is not supported. If you would like to publish for a single RID, specify the RID at the individual project level instead.|
|NETSDK1135|SupportedOSPlatformVersion {0} cannot be higher than TargetPlatformVersion {1}.|
|NETSDK1136|The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so.|
|NETSDK1137|It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'.|
|NETSDK1138|The target framework '{0}' is out of support and will not receive security updates in the future. Please refer to <https://aka.ms/dotnet-core-support> for more information about the support policy.|
|[NETSDK1135](netsdk1135.md)|SupportedOSPlatformVersion {0} cannot be higher than TargetPlatformVersion {1}.|
|[NETSDK1136](netsdk1136.md)|The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so.|
|[NETSDK1137](netsdk1137.md)|It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'.|
|[NETSDK1138](netsdk1138.md)|The target framework '{0}' is out of support and will not receive security updates in the future. Please refer to <https://aka.ms/dotnet-core-support> for more information about the support policy.|
|NETSDK1139|The target platform identifier {0} was not recognized.|
|NETSDK1140|{0} is not a valid TargetPlatformVersion for {1}. Valid versions include:|
|[NETSDK1141](netsdk1141.md)|Unable to resolve the .NET SDK version as specified in the global.json located at {0}.|
Expand Down Expand Up @@ -179,7 +179,7 @@ This is a complete list of the errors that you might get from the .NET SDK while
|NETSDK1178|The project depends on the following workload packs that do not exist in any of the workloads available in this installation: {0}.|
|NETSDK1179|One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used.|
|NETSDK1181|Error getting pack version: Pack '{0}' was not present in workload manifests.|
|NETSDK1182|Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported.|
|[NETSDK1182](netsdk1182.md)|Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported.|
|NETSDK1183|Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true.|
|NETSDK1184|The Targeting Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true.|
|NETSDK1185|The Runtime Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true.|
Expand Down
25 changes: 25 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1082.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "NETSDK1082: There was no runtime pack available"
description: Learn about .NET SDK error NETSDK1082, which warns about an unavailable runtime pack for the specified RID.
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1082
---
# NETSDK1082: PackageReference to Microsoft.AspNetCore.App is not necessary

NETSDK1082 warns you that the runtime pack for your [runtime identifier](../../rid-catalog.md) (RID) could not be found in your NuGet feed. The full error message is similar to the following example:

>There was no runtime pack for \<RuntimePack> available for the specified RuntimeIdentifier '\<RID>'.

.NET automatically downloads known runtime packs for self-contained applications but there could be a pointer to one that's not available to you. Investigate your NuGet configuration and feeds to find out why the required runtime pack is missing. In some scenarios, you might have to override the `LatestRuntimeFrameworkVersion` value to one that's available on your NuGet feeds by adding markup like the following example to the project file:

```xml
<ItemGroup>
<KnownRuntimePack Update="@(KnownRuntimePack)">
<LatestRuntimeFrameworkVersion Condition="'%(TargetFramework)' == 'TARGETFRAMEWORK'">EXISTINGVERSION</LatestRuntimeFrameworkVersion>
</KnownRuntimePack>
</ItemGroup>
```

In this example, TARGETFRAMEWORK represents values like `net6.0`, `net5.0`, or `netcoreapp3.1` -- basically anything that’s in the **NET 5+ (and .NET Core)** list in [Supported target frameworks](../../../standard/frameworks.md#supported-target-frameworks). EXISTINGVERSION would need to be a valid version that has been released. For example, `6.0.7` for `net6.0`, `5.0.17` for `net5.0`, and so forth. For information about released versions, see [Download .NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0) and [Download .NET 5.0](https://dotnet.microsoft.com/download/dotnet/5.0).
31 changes: 31 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1100.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: "NETSDK1100: Set the `EnableWindowsTargeting` property to true"
description: Learn about the .NET SDK error message that instructs you to set the EnableWindowsTargeting property to true.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1100
---
# NETSDK1100: Set the EnableWindowsTargeting property to true

NETSDK1100 indicates that you're building a project that targets Windows on Linux or macOS. The full error message is similar to the following example:

> To build a project targeting Windows on this operating system, set the `EnableWindowsTargeting` property to true.

To resolve this error, set the `EnableWindowsTargeting` property to true. You can set it in the project file or by passing `/p:EnableWindowsTargeting=false` to a .NET CLI command, such as `dotnet build`. Here's an example project file:

```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
</Project>
```

If you want to apply this setting to your whole solution or repository, you can set it in a *Directory.Build.props* file.

By default, .NET downloads all targeting packs (and runtime packs for self-contained builds) for the current target framework whether they're needed or not, because they might be brought in by a transitive framework reference. We didn't want to ship the Windows targeting packs with the non-Windows SDK builds, but we also didn't want a vanilla Console or ASP.NET Core app to automatically download these targeting and runtime packs the first time you build. The `EnableWindowsTargeting` property enables them to only be downloaded if you opt in.
20 changes: 20 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1112.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: "NETSDK1112: The runtime pack was not downloaded"
description: How to resolve the `runtime pack was not downloaded' error message.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1112
---
# NETSDK1112: The runtime pack was not downloaded

A runtime pack that your project requires was not downloaded. The full error message is similar to the following example:

> The runtime pack for `<Runtime>` was not downloaded. Try running a NuGet restore with the RuntimeIdentifier '`<RID>`'.

This can happen in the following scenarios:

* The publish parameters are different than what's in the project file. Review publish parameters and change any instances where publish parameters differ from the project file.
* You used Debug configuration to build an app that is set up to require Release configuration. Try building with Release configuration.
17 changes: 17 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1135.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "NETSDK1135: SupportedOSPlatformVersion can't be higher than TargetPlatformVersion"
description: How to resolve the `SupportedOSPlatformVersion can't be higher than TargetPlatformVersion' error.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1135
---
# NETSDK1135: SupportedOSPlatformVersion can't be higher than TargetPlatformVersion

The value that your project file specifies for `SupportedOSPlatformVersion` is too high. The full error message is similar to the following example:

> SupportedOSPlatformVersion `<Version>` cannot be higher than `TargetPlatformVersion` `<Version>`.

Check your project files for `SupportedOSPlatformVersion`. `TargetPlatformVersion` (TPV) is inferred from the `TargetFramework` value. For example, `net6.0-windows10.0.19041` will set the TPV to be `10.0.19041`. .NET uses `TargetPlatformVersion` to determine which APIs are available at compile time.
25 changes: 25 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1136.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: "NETSDK1136: The target platform must be set to Windows"
description: Learn about the .NET SDK error that directs you to set your target platform to Windows.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1136
---
# NETSDK1136: The target framework must be Windows

If `UseWindowsForms` or `UseWPF` is `true`, .NET assumes that your project is a Windows app, and so the platform has to be set to Windows. This error can happen if you have a project-to-project reference where one is set to Windows and the other is not. The full error message is similar to the following example:

>The target platform must be set to Windows (usually by including `-windows` in the `TargetFramework` property) when using Windows Forms or WPF, or referencing projects or packages that do so.

For example, set `TargetFramework` to `net6.0-windows`, as shown in this project file:

```xml
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
</PropertyGroup>
</Project>
```
17 changes: 17 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1137.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: "NETSDK1137: Don't use the Microsoft.NET.Sdk.WindowsDesktop SDK"
description: How to resolve the `Don't use the Microsoft.NET.Sdk.WindowsDesktop SDK' error message.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1137
---
# NETSDK1137: Don't use the Microsoft.NET.Sdk.WindowsDesktop SDK

NETSDK1137 indicates that your project specifies an outdated project SDK. The full error message is similar to the following example:

> It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'.

To resolve this error, modify your project file to have `<Project Sdk="Microsoft.NET.Sdk">` instead of the `WindowsDesktop` SDK.
41 changes: 41 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1138.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: "NETSDK1138: The target framework is out of support"
description: How to resolve the `framework out of support' error message.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1138
---
# NETSDK1138: The target framework is out of support

NETSDK1138 indicates that your project targets a version of the framework that is out of support. The full error message is similar to the following example:

> The target framework '\<framework>' is out of support and will not receive security updates in the future. Please refer to <https://aka.ms/dotnet-core-support> for more information about the support policy.

Out-of-support versions include 1.0, 1.1, 2.0, 2.1, 2.2, and 3.0. In November 2022, .NET 5 will be added to this list.

To resolve this error, change your project to target a supported version of .NET Core or .NET 5+.

If you want to suppress the message without targeting a later framework, set the MSBuild property `CheckEolTargetFramework` to false. You can set it in the project file or by passing `/p:CheckEolTargetFramework=false` to a .NET CLI command, such as `dotnet build`. Here's an example project file:

```xml
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup>
</Project>
```

Here's an example .NET CLI command:

```dotnetcli
dotnet build /p:CheckEolTargetFramework=false
```

## See also

* <https://aka.ms/dotnet-core-support>
21 changes: 21 additions & 0 deletions docs/core/tools/sdk-errors/netsdk1182.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: "NETSDK1182: Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported."
description: Learn about the 'Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported' error message.
author: tdykstra
ms.author: tdykstra
ms.topic: error-reference
ms.date: 07/08/2022
f1_keywords:
- NETSDK1182
---
# NETSDK1182: Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported

NETSDK1182 indicates that you're trying to open a .NET 6+ project in Visual Studio 2019. Or you might be trying to build from the command line using MSBuild from Visual Studio 2019. The full error message is similar to the following example:

> Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported.

To resolve this error switch to Visual Studio 2022, or change your project to target .NET 5 or earlier.

## See also

* [Overview of .NET, MSBuild, and Visual Studio versioning](../../porting/versioning-sdk-msbuild-vs.md)
16 changes: 16 additions & 0 deletions docs/fundamentals/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,20 @@ items:
href: ../core/tools/sdk-errors/netsdk1079.md
- name: NETSDK1080
href: ../core/tools/sdk-errors/netsdk1080.md
- name: NETSDK1082
href: ../core/tools/sdk-errors/netsdk1082.md
- name: NETSDK1100
href: ../core/tools/sdk-errors/netsdk1100.md
- name: NETSDK1112
href: ../core/tools/sdk-errors/netsdk1112.md
- name: NETSDK1135
href: ../core/tools/sdk-errors/netsdk1135.md
- name: NETSDK1136
href: ../core/tools/sdk-errors/netsdk1136.md
- name: NETSDK1137
href: ../core/tools/sdk-errors/netsdk1137.md
- name: NETSDK1138
href: ../core/tools/sdk-errors/netsdk1138.md
- name: NETSDK1130
href: ../core/tools/sdk-errors/netsdk1130.md
- name: NETSDK1141
Expand All @@ -237,6 +251,8 @@ items:
href: ../core/tools/sdk-errors/netsdk1149.md
- name: NETSDK1174
href: ../core/tools/sdk-errors/netsdk1174.md
- name: NETSDK1182
href: ../core/tools/sdk-errors/netsdk1182.md
- name: .NET CLI
items:
- name: Overview
Expand Down