-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Closed
Copy link
Description
Steps to reproduce
- Create a hello world program:
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Console.WriteLine($"Base Directory: {AppContext.BaseDirectory}");
Console.WriteLine($"Assembly Location: {typeof(Program).Assembly.Location}");
}-
Publish self contained -
dotnet publish -c Release -r win-x64 -p:PublishSingleFile=True --self-contained false(or self-contained) -
Run the resulting exe file.
Expected behavior
According to the design document, AppContext.BaseDirectory is the API that developers should use to access the path where the app host resides.
The app context base directory should therefore not be in AppData\Local\Temp\.net\.
Background: I want to use this directory to load override config files.
Actual behavior
C:\demos\testcons\bin\Release\netcoreapp3.0\win-x64\publish>testcons.exe
Hello World!
Base Directory: C:\Users\ullrimar\AppData\Local\Temp\.net\testcons\53kpwgv0.3mq\
Assembly Location: C:\Users\ullrimar\AppData\Local\Temp\.net\testcons\53kpwgv0.3mq\testcons.dll
Environment data
>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100-preview7-012821
Commit: 6348f1068a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview7-012821\
Host (useful for support):
Version: 3.0.0-preview7-27912-14
Commit: 4da6ee6450
cc @vitek-karas
Davidwalser, replaysMike, pikoslav, martinzima, keerthivasanm and 20 more