Skip to content

Do not set executing script directory when publishing #49368

@RikkiGibson

Description

@RikkiGibson

Related to #49184

We should not set an entry point directory when publishing a file-based program, as the app is expected to be deployed to another machine where the entry point (source code) path will not be useful.

e.g.

// app.cs
var entryPointFilePath = AppContext.GetData("EntryPointFilePath") as string;
Console.WriteLine($"""EntryPointFilePath: {entryPointFilePath}""");
# On build machine
$ dotnet publish app.cs

# Deploy to prod machine
$ dotnet app.dll
EntryPointFilePath: # should not have a value for 'EntryPointFilePath'

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions