Skip to content

Add a new SDK Resolver that can load an Sdk by relative path #51367

@baronfel

Description

@baronfel

Is your feature request related to a problem? Please describe.

When developing a custom SDK it's really hard to actually test that SDK in-situ, especially when using file-based apps. The Aspire team runs into this when wanting to test their SDK - you can't load sdk props/targets via Directory.Build.props because by the time the base .NET SDK looks for those files certain default props have already been 'fixed'/pinned. For an example of what they have to do see https://github.com/dotnet/aspire/pull/11502/files#diff-7df52ae746222b673e8f279cb09b643ca3ac312c7033d6e985e1eace8975a67d.

Describe the solution you'd like

We should ship an SdkResolver that can be given a relative file path and loads an Sdk.props/Sdk.targets from that path:

#:sdk ../../../artifacts/bin/Aspire.SDK

var builder = DistributedApplication.CreateBuilder(args);

builder.AddCSharpApp("api", "api.cs");

#if !SKIP_DASHBOARD_REFERENCE
// This project is only added in playground projects to support development/debugging
// of the dashboard. It is not required in end developer code. Comment out this code
// or build with `/p:SkipDashboardReference=true`, to test end developer
// dashboard launch experience, Refer to Directory.Build.props for the path to
// the dashboard binary (defaults to the Aspire.Dashboard bin output in the
// artifacts dir).
builder.AddProject<Projects.Aspire_Dashboard>(KnownResourceNames.AspireDashboard);
#endif

builder.Build().Run();

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions