Skip to content

Add diagnostic articles #3379

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 3 commits into from
May 8, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/diagnostics/aspire001.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Compiler Warning ASPIRE001
description: Learn more about compiler Warning ASPIRE001. The code language isn't fully supported by Aspire - some code generation targets will not run, so will require manual authoring.
ms.date: 05/08/2025
f1_keywords:
- "ASPIRE001"
helpviewer_keywords:
- "ASPIRE001"
---

# Compiler Warning ASPIRE001

**Version introduced:** 8.0.0

> The 'CODELANGUAGE' language isn't fully supported by Aspire - some code generation targets will not run, so will require manual authoring.

This diagnostic warning is reported when using a code language other than C#.

## To correct this warning

In your .NET Aspire project, use C#.

## Suppress the warning

Suppress the warning with either of the following methods:

- Set the severity of the rule in the _.editorConfig_ file.

```ini
[*.{cs,vb}]
dotnet_diagnostic.ASPIRE001.severity = none
```

For more information about editor config files, see [Configuration files for code analysis rules](/dotnet/fundamentals/code-analysis/configuration-files).

- Add the following `PropertyGroup` to your project file:

```xml
<PropertyGroup>
<NoWarn>$(NoWarn);ASPIRE001</NoWarn>
</PropertyGroup>
```
21 changes: 21 additions & 0 deletions docs/diagnostics/aspire002.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Compiler Warning ASPIRE002
description: Learn more about compiler Warning ASPIRE002. Project is an Aspire AppHost project but necessary dependencies aren't present. Are you missing an Aspire.Hosting.AppHost PackageReference?
ms.date: 05/08/2025
f1_keywords:
- "ASPIRE002"
helpviewer_keywords:
- "ASPIRE002"
---

# Compiler Warning ASPIRE002

**Version introduced:** 8.0.0

> 'Project' is an Aspire AppHost project but necessary dependencies aren't present. Are you missing an Aspire.Hosting.AppHost PackageReference?

This diagnostic warning is reported when your project is missing reference to the .NET Aspire App Host.

## To correct this warning

Add reference to the [📦 Aspire.Hosting.AppHost](https://www.nuget.org/packages/Aspire.Hosting.AppHost) NuGet package. For more information about the app host, see [.NET Aspire orchestration overview](../fundamentals/app-host-overview.md).
21 changes: 21 additions & 0 deletions docs/diagnostics/aspire003.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
title: Compiler Warning ASPIRE003
description: Learn more about compiler Warning ASPIRE003. Project is a .NET Aspire AppHost project that requires Visual Studio version 17.10 or above to work correctly.
ms.date: 05/08/2025
f1_keywords:
- "ASPIRE003"
helpviewer_keywords:
- "ASPIRE003"
---

# Compiler Warning ASPIRE003

**Version introduced:** 8.0.0

> 'Project' is a .NET Aspire AppHost project that requires Visual Studio version 17.10 or above to work correctly.

When using Visual Studio to code your .NET Aspire project, you must have Visual Studio 2022 version 17.10 or later.

## To correct this warning

Upgrade Visual Studio 2022 to latest version, or at a minimum, version 17.20.
48 changes: 48 additions & 0 deletions docs/diagnostics/aspire004.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Compiler Warning ASPIRE004
description: Learn more about compiler Warning ASPIRE004. Project is referenced by an Aspire Host project, but it is not an executable.
ms.date: 05/08/2025
f1_keywords:
- "ASPIRE004"
helpviewer_keywords:
- "ASPIRE004"
---

# Compiler Warning ASPIRE004

**Version introduced:** 8.0.0

> 'Project' is referenced by an Aspire Host project, but it is not an executable. Did you mean to set IsAspireProjectResource="false"?

The project being referenced byt the .NET Aspire App Host isn't an executable, but is being treated like one for the purposes of orchestration.

## To correct this warning

Either change the build type of the project to an executable, or add the `IsAspireProjectResource="false"` setting to the project reference in your .NET Aspire App Host project file, as demonstrated in the following snippet:

```xml
<ItemGroup>
<ProjectReference Include="..\OtherProjects\Contracts.csproj" IsAspireProjectResource="false" />
</ItemGroup>
```

## Suppress the warning

Suppress the warning with either of the following methods:

- Set the severity of the rule in the _.editorConfig_ file.

```ini
[*.{cs,vb}]
dotnet_diagnostic.ASPIRE004.severity = none
```

For more information about editor config files, see [Configuration files for code analysis rules](/dotnet/fundamentals/code-analysis/configuration-files).

- Add the following `PropertyGroup` to your project file:

```xml
<PropertyGroup>
<NoWarn>$(NoWarn);ASPIRE004</NoWarn>
</PropertyGroup>
```
43 changes: 43 additions & 0 deletions docs/diagnostics/aspire007.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Compiler Error ASPIRE007
description: Learn more about compiler Error ASPIRE007. 'Project' requires a reference to "Aspire.AppHost.Sdk" with version "9.0.0" or greater to work correctly.
ms.date: 05/08/2025
f1_keywords:
- "ASPIRE007"
helpviewer_keywords:
- "ASPIRE007"
---

# Compiler Error ASPIRE007

**Version introduced:** 9.0.0

> 'Project' requires a reference to "Aspire.AppHost.Sdk" with version "9.0.0" or greater to work correctly. Please add the following line after the Project declaration `<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />`.

The .NET Aspire App Host package references require .NET Aspire SDK version 9.0.0 or greater. The SDK reference is either being omitted or is using a version older than 9.0.0.

## To correct this error

Update the referenced SDK version to 9.0.0 or the latest.

If the SDK reference is missing from your project file, add it, as demonstrated in the following snippet:

```xml
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="9.0.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsAspireHost>true</IsAspireHost>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="9.2.0" />
</ItemGroup>

</Project>
```
52 changes: 52 additions & 0 deletions docs/diagnostics/aspirecompute001.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Compiler Error ASPIRECOMPUTE001
description: Learn more about compiler Error ASPIRECOMPUTE001. Compute related types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.
ms.date: 05/08/2025
f1_keywords:
- "ASPIRECOMPUTE001"
helpviewer_keywords:
- "ASPIRECOMPUTE001"
---

# Compiler Error ASPIRECOMPUTE001

**Version introduced:** 9.3

> Compute related types and members are for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

## Example

The following code generates `ASPIRECOMPUTE001`:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

builder.AddDockerComposeEnvironment("env");
// or
builder.AddAzureContainerAppEnvironment("env")
// or
builder.AddKubernetesEnvironment("env")
```

## To correct this Error

Suppress the Error with either of the following methods:

- Set the severity of the rule in the _.editorConfig_ file.

```ini
[*.{cs,vb}]
dotnet_diagnostic.ASPIRECOMPUTE001.severity = none
```

For more information about editor config files, see [Configuration files for code analysis rules](/dotnet/fundamentals/code-analysis/configuration-files).

- Add the following `PropertyGroup` to your project file:

```xml
<PropertyGroup>
<NoWarn>$(NoWarn);ASPIRECOMPUTE001</NoWarn>
</PropertyGroup>
```

- Suppress in code with the `#pragma warning disable ASPIRECOMPUTE001` directive.
57 changes: 57 additions & 0 deletions docs/diagnostics/aspireproxyendpoints001.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Compiler Error ASPIREPROXYENDPOINTS001
description: Learn more about compiler Error ASPIREPROXYENDPOINTS001. Members are for evaluation purposes only and are subject to change or removal in future updates.
ms.date: 05/08/2025
f1_keywords:
- "ASPIREPROXYENDPOINTS001"
helpviewer_keywords:
- "ASPIREPROXYENDPOINTS001"
---

# Compiler Error ASPIREPROXYENDPOINTS001

**Version introduced:** 9.1

> `WithEndpointProxySupport` is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

-or-

> `ProxySupportAnnotation` is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

Both `WithEndpointProxySupport` and `ProxySupportAnnotation` are considered experimental APIs.

Container resources use proxied endpoints by default. Adjusting this setting is experimental. For more information, see <xref:Aspire.Hosting.ContainerResourceBuilderExtensions.WithEndpointProxySupport*>.

## Example

The following code generates `ASPIREPROXYENDPOINTS001`:

```csharp
var builder = DistributedApplication.CreateBuilder(args);

var redis = builder.AddRedis($"example-redis", 1234)
.WithEndpointProxySupport(false);
```

## To correct this Error

Suppress the Error with either of the following methods:

- Set the severity of the rule in the _.editorConfig_ file.

```ini
[*.{cs,vb}]
dotnet_diagnostic.ASPIREPROXYENDPOINTS001.severity = none
```

For more information about editor config files, see [Configuration files for code analysis rules](/dotnet/fundamentals/code-analysis/configuration-files).

- Add the following `PropertyGroup` to your project file:

```xml
<PropertyGroup>
<NoWarn>$(NoWarn);ASPIREPROXYENDPOINTS001</NoWarn>
</PropertyGroup>
```

- Suppress in code with the `#pragma warning disable ASPIREPROXYENDPOINTS001` directive.
23 changes: 15 additions & 8 deletions docs/diagnostics/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,18 @@ ms.date: 04/15/2025

The following table lists the possible MSBuild and .NET Analyzer warnings and errors you might encounter with .NET Aspire:

| Diagnostic ID | Type | Description |
|-------------------------------------------------------|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`ASPIRE006`](ASPIRE006.md) | (Experimental) Error | <span id="ASPIRE006"></span> Application model items must have valid names. |
| [`ASPIREACADOMAINS001`](ASPIREACADOMAINS001.md) | (Experimental) Error | <span id="ASPIREACADOMAINS001"></span> `ConfigureCustomDomain` is for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIREAZURE001`](ASPIREAZURE001.md) | (Experimental) Error | <span id="ASPIREAZURE001"></span> Publishers are for evaluation purposes only and are subject to change or removal in future updates. |
| [`ASPIRECOSMOSDB001`](ASPIRECOSMOSDB001.md) | (Experimental) Error | <span id="ASPIRECOSMOSDB001"></span> `RunAsPreviewEmulator` is for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIREHOSTINGPYTHON001`](ASPIREHOSTINGPYTHON001.md) | (Experimental) Error | <span id="ASPIREHOSTINGPYTHON001"></span> `AddPythonApp` is for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIREPUBLISHERS001`](ASPIREPUBLISHERS001.md) | Error | <span id="ASPIREPUBLISHERS001"></span> Publishers are for evaluation purposes only and are subject to change or removal in future updates. |
| Diagnostic ID | Type | Description |
|---------------------------------------------------------|----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`ASPIRE001`](aspire001.md) | Warning | <span id="ASPIRE001"></span> The code language isn't fully supported by Aspire, some code generation targets will not run. |
| [`ASPIRE002`](aspire002.md) | Warning | <span id="ASPIRE002"></span> Project is an Aspire AppHost project but necessary dependencies aren't present. Are you missing an Aspire.Hosting.AppHost PackageReference? |
| [`ASPIRE003`](aspire003.md) | Warning | <span id="ASPIRE003"></span> 'Project' is a .NET Aspire AppHost project that requires Visual Studio version 17.10 or above to work correctly. |
| [`ASPIRE004`](aspire004.md) | Warning | <span id="ASPIRE004"></span> 'Project' is referenced by an Aspire Host project, but it is not an executable. |
| [`ASPIRE006`](aspire006.md) | (Experimental) Error | <span id="ASPIRE006"></span> Application model items must have valid names. |
| [`ASPIRE007`](aspire007.md) | Error | <span id="ASPIRE007"></span> 'Project' requires a reference to "Aspire.AppHost.Sdk" with version "9.0.0" or greater to work correctly. |
| [`ASPIREACADOMAINS001`](aspireacadomains001.md) | (Experimental) Error | <span id="ASPIREACADOMAINS001"></span> `ConfigureCustomDomain` is for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIREAZURE001`](aspireazure001.md) | (Experimental) Error | <span id="ASPIREAZURE001"></span> Publishers are for evaluation purposes only and are subject to change or removal in future updates. |
| [`ASPIRECOMPUTE001`](aspirecompute001.md) | (Experimental) Error | <span id="ASPIRECOMPUTE001"></span> Compute related types and members are for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIRECOSMOSDB001`](aspirecosmosdb001.md) | (Experimental) Error | <span id="ASPIRECOSMOSDB001"></span> `RunAsPreviewEmulator` is for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIREHOSTINGPYTHON001`](aspirehostingpython001.md) | (Experimental) Error | <span id="ASPIREHOSTINGPYTHON001"></span> `AddPythonApp` is for evaluation purposes only and is subject to change or removal in future updates. |
| [`ASPIREPROXYENDPOINTS001`](aspireproxyendpoints001.md) | (Experimental) Error | <span id="ASPIREPROXYENDPOINTS001"></span> ProxyEndpoint members are for evaluation purposes only and are subject to change or removal in future updates. |
| [`ASPIREPUBLISHERS001`](aspirepublishers001.md) | Error | <span id="ASPIREPUBLISHERS001"></span> Publishers are for evaluation purposes only and are subject to change or removal in future updates. |
32 changes: 32 additions & 0 deletions docs/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -425,22 +425,50 @@ items:
items:
- name: Overview
href: diagnostics/overview.md
- name: Warnings
items:
- name: ASPIRE001
href: diagnostics/aspire001.md
- name: ASPIRE002
href: diagnostics/aspire002.md
- name: ASPIRE003
href: diagnostics/aspire003.md
- name: ASPIRE004
href: diagnostics/aspire004.md
- name: Errors
items:
- name: ASPIRE006
href: diagnostics/aspire006.md
- name: ASPIRE007
href: diagnostics/aspire007.md
- name: ASPIREACADOMAINS001
href: diagnostics/aspireacadomains001.md
- name: ASPIRECOMPUTE001
href: diagnostics/aspirecompute001.md
- name: ASPIRECOSMOSDB001
href: diagnostics/aspirecosmosdb001.md
- name: ASPIREHOSTINGPYTHON001
href: diagnostics/aspirehostingpython001.md
- name: ASPIREPROXYENDPOINTS001
href: diagnostics/aspireproxyendpoints001.md
- name: ASPIREPUBLISHERS001
href: diagnostics/aspirepublishers001.md
- name: ASPIREAZURE001
href: diagnostics/aspireazure001.md
- name: By category
items:
- name: Project
items:
- name: Code language not fully supported
href: diagnostics/aspire001.md
- name: Aspire.Hosting.AppHost is missing
href: diagnostics/aspire002.md
- name: Version of Visual Studio not supported
href: diagnostics/aspire003.md
- name: Referenced project isn't an executable
href: diagnostics/aspire004.md
- name: Aspire SDK reference is out of date or missing
href: diagnostics/aspire007.md
- name: Resources
items:
- name: Items must have valid names
Expand All @@ -451,6 +479,10 @@ items:
href: diagnostics/aspireacadomains001.md
- name: Cosmos DB preview emulator and data explorer
href: diagnostics/aspirecosmosdb001.md
- name: Various compute APIs are experimental
href: diagnostics/aspirecompute001.md
- name: Container proxy endpoint APIs are experimental
href: diagnostics/aspireproxyendpoints001.md
- name: Hosting Python apps
href: diagnostics/aspirehostingpython001.md
- name: Publishing APIs are experimental
Expand Down
Loading