Skip to content

dotnet run file custom entrypoint support #49151

Closed as not planned
Closed as not planned
@WeihanLi

Description

@WeihanLi

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

When there's no entry point for the file(s), maybe we could allow the user provider a custom entry point to execute, hope it could be part of the dotnet run file experience #48170

Describe the solution you'd like

When there's no entry point in the file(s), and user user-provided entry point is valid, mark it as the entry point other than fail.

For example, we have the following file named helper.cs

public class Helper
{
  public static void AddTest()
  {
    var a = 1;
    var b = 2;
    Console.WriteLine(a + b);
  }

  public static void HelloTest()
  {
    Console.WriteLine("Hello World!");
  }
}
dotnet helper.cs --entry HelloTest

output:

Hello World!

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-run-fileItems related to the "dotnet run <file>" effort

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions