Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Dotnet/DotnetProjectBuildCoordinator.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREDOTNETPROJECT001, ASPIREEXTENSION001, ASPIREPIPELINES001, ASPIREPROJECTS001
#pragma warning disable ASPIREEXTENSION001, ASPIREPIPELINES001, ASPIREPROJECTS001

using System.Globalization;
using System.Runtime.CompilerServices;
Expand Down
12 changes: 0 additions & 12 deletions src/Aspire.Hosting.Dotnet/DotnetProjectHostingExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Dotnet;
Expand Down Expand Up @@ -65,7 +64,6 @@ public static class DotnetProjectHostingExtensions
/// .WithBuildEnvironment("BUILD_FLAVOR", "custom");
/// </code>
/// </example>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport]
public static IResourceBuilder<DotnetProjectResource> WithBuildEnvironment(
this IResourceBuilder<DotnetProjectResource> builder,
Expand Down Expand Up @@ -107,7 +105,6 @@ public static IResourceBuilder<DotnetProjectResource> WithBuildEnvironment(
/// temporary MSBuild response files, and the values can appear in build diagnostics.
/// </para>
/// </remarks>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExportIgnore(Reason = "Raw Action delegate callbacks are not ATS-compatible.")]
public static IResourceBuilder<DotnetProjectResource> WithBuildEnvironment(
this IResourceBuilder<DotnetProjectResource> builder,
Expand Down Expand Up @@ -151,7 +148,6 @@ public static IResourceBuilder<DotnetProjectResource> WithBuildEnvironment(
/// temporary MSBuild response files, and the values can appear in build diagnostics.
/// </para>
/// </remarks>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExportIgnore(Reason = "Raw Func delegate callbacks are not ATS-compatible.")]
public static IResourceBuilder<DotnetProjectResource> WithBuildEnvironment(
this IResourceBuilder<DotnetProjectResource> builder,
Expand Down Expand Up @@ -181,7 +177,6 @@ internal static void ValidateBuildEnvironmentSupport(IResource resource, IProjec
/// <summary>
/// Configures the number of .NET project replicas for polyglot AppHosts.
/// </summary>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport("withDotnetProjectReplicas", MethodName = "withReplicas")]
internal static IResourceBuilder<DotnetProjectResource> WithReplicasForPolyglot(
this IResourceBuilder<DotnetProjectResource> builder,
Expand All @@ -193,7 +188,6 @@ internal static IResourceBuilder<DotnetProjectResource> WithReplicasForPolyglot(
/// <summary>
/// Disables forwarded headers for a .NET project in polyglot AppHosts.
/// </summary>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport("disableDotnetProjectForwardedHeaders", MethodName = "disableForwardedHeaders")]
internal static IResourceBuilder<DotnetProjectResource> DisableForwardedHeadersForPolyglot(
this IResourceBuilder<DotnetProjectResource> builder)
Expand All @@ -204,7 +198,6 @@ internal static IResourceBuilder<DotnetProjectResource> DisableForwardedHeadersF
/// <summary>
/// Configures endpoint environment-variable injection for a .NET project in polyglot AppHosts.
/// </summary>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport("withDotnetProjectEndpointsInEnvironment", MethodName = "withEndpointsInEnvironment")]
internal static IResourceBuilder<DotnetProjectResource> WithEndpointsInEnvironmentForPolyglot(
this IResourceBuilder<DotnetProjectResource> builder,
Expand Down Expand Up @@ -244,7 +237,6 @@ internal static IResourceBuilder<DotnetProjectResource> WithEndpointsInEnvironme
/// </code>
/// </example>
/// </remarks>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExportIgnore(Reason = "Polyglot AppHosts use the internal addDotnetProject dispatcher export.")]
public static IResourceBuilder<DotnetProjectResource> AddDotnetProject(this IDistributedApplicationBuilder builder, [ResourceName] string name, string path)
{
Expand All @@ -258,7 +250,6 @@ public static IResourceBuilder<DotnetProjectResource> AddDotnetProject(this IDis
/// <summary>
/// Adds a C# application resource.
/// </summary>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport("addDotnetProject")]
internal static IResourceBuilder<DotnetProjectResource> AddDotnetProjectForPolyglot(
this IDistributedApplicationBuilder builder,
Expand Down Expand Up @@ -296,7 +287,6 @@ internal static IResourceBuilder<DotnetProjectResource> AddDotnetProjectForPolyg
/// </code>
/// </example>
/// </remarks>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExportIgnore(Reason = "Polyglot AppHosts use the internal addDotnetProject dispatcher export.")]
public static IResourceBuilder<DotnetProjectResource> AddDotnetProject(this IDistributedApplicationBuilder builder, [ResourceName] string name, string path, Action<ProjectResourceOptions> configure)
{
Expand Down Expand Up @@ -468,7 +458,6 @@ List<string> GetLaunchProfileArguments(IResource resource)
return resource;
}

#pragma warning disable ASPIREDOTNETPROJECT001
internal static async Task<DotnetProjectRunProperties> ResolveRunPropertiesAfterBuildAsync(
DotnetProjectBuildCoordinator.CoordinatorState coordinator,
DotnetProjectResource resource,
Expand All @@ -483,7 +472,6 @@ await coordinator.WaitForBuildCompletionAsync(

return await resolver(cancellationToken).ConfigureAwait(false);
}
#pragma warning restore ASPIREDOTNETPROJECT001

private static void ApplyProjectResourceOptions(ProjectResourceOptions target, DotnetProjectOptions source)
{
Expand Down
2 changes: 0 additions & 2 deletions src/Aspire.Hosting.Dotnet/DotnetProjectResource.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.ApplicationModel;

#pragma warning disable ASPIREPROJECTS001 // ProjectLaunchDefaultsAnnotation is experimental.
Expand All @@ -23,7 +22,6 @@ namespace Aspire.Hosting.Dotnet;
/// explicitly configured for publishing by its builder.
/// </para>
/// </remarks>
[Experimental("ASPIREDOTNETPROJECT001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport(ExposeProperties = true)]
public class DotnetProjectResource :
ExecutableResource,
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Use this integration to model, configure, and orchestrate C# projects and file-b
`Aspire.Hosting.Python`, and `Aspire.Hosting.JavaScript`.

> [!NOTE]
> `AddDotnetProject` is experimental and is exposed under the `ASPIREDOTNETPROJECT001` diagnostic.
> `Aspire.Hosting.Dotnet` is a prerelease package.
> Its API surface may change in future releases.

## Getting started
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREDOTNETPROJECT001, ASPIREEXTENSION001, ASPIREPIPELINES001, ASPIREPROJECTS001
#pragma warning disable ASPIREEXTENSION001, ASPIREPIPELINES001, ASPIREPROJECTS001

using System.IO.Compression;
using System.Reflection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREDOTNETPROJECT001, ASPIREPROJECTS001
#pragma warning disable ASPIREPROJECTS001

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Utils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREDOTNETPROJECT001
#pragma warning disable ASPIREEXTENSION001

using Aspire.Hosting.ApplicationModel;
Expand Down
34 changes: 0 additions & 34 deletions tests/Aspire.Hosting.Dotnet.Tests/DotnetProjectPublicApiTests.cs
Original file line number Diff line number Diff line change
@@ -1,56 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREDOTNETPROJECT001
#pragma warning disable ASPIREPROJECTS001

using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Utils;

namespace Aspire.Hosting.Dotnet.Tests;

public class DotnetProjectPublicApiTests
{
// ---- Experimental tagging ------------------------------------------------------

[Fact]
public void DotnetProjectResourceIsTaggedWithExpectedExperimentalDiagnostic()
{
var attribute = Assert.Single(typeof(DotnetProjectResource).GetCustomAttributes<ExperimentalAttribute>());

Assert.Equal("ASPIREDOTNETPROJECT001", attribute.DiagnosticId);
Assert.Equal("https://aka.ms/aspire/diagnostics/{0}", attribute.UrlFormat);
}

[Fact]
public void DotnetProjectResourceImplementsPublishingContracts()
{
Assert.True(typeof(IDotnetProgramResource).IsAssignableFrom(typeof(DotnetProjectResource)));
Assert.True(typeof(IContainerFilesDestinationResource).IsAssignableFrom(typeof(DotnetProjectResource)));
}

[Fact]
public void EveryPublicAddDotnetProjectOverloadIsTaggedWithExpectedExperimentalDiagnostic()
{
var overloads = typeof(DotnetProjectHostingExtensions)
.GetMethods(BindingFlags.Public | BindingFlags.Static)
.Where(m => m.Name == nameof(DotnetProjectHostingExtensions.AddDotnetProject))
.ToList();

// Guards against silently losing coverage if an overload is added or removed.
Assert.Equal(2, overloads.Count);

foreach (var method in overloads)
{
var attribute = Assert.Single(method.GetCustomAttributes<ExperimentalAttribute>());

Assert.Equal("ASPIREDOTNETPROJECT001", attribute.DiagnosticId);
Assert.Equal("https://aka.ms/aspire/diagnostics/{0}", attribute.UrlFormat);
}
}

// ---- DotnetProjectResource constructor guards --------------------------------

[Theory]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREDOTNETPROJECT001
#pragma warning disable ASPIREEXTENSION001
#pragma warning disable ASPIREPERSISTENCE001
#pragma warning disable ASPIREPIPELINES001
Expand Down
Loading