dotnet / dotnet/sdk

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

Open
#51,367 0 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Area-run-file Area-SdkResolvers
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### 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:

```csharp
#: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(KnownResourceNames.AspireDashboard);
#endif

builder.Build().Run();
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.