netcoreapp3.0

How to get actual path to executable when using .netcore 3.0 and using the /p:PublishSingleFile=true flag?

China☆狼群 提交于 2019-12-02 11:19:23
问题 I recently upgraded an application to dotnet core 3 and started using the PublishSingleFile flag during the build process. With these two changes the way the executable path is found has changed. Now instead of getting the path where the executable file is, I get redirected to a random directory in /var/tmp/.net/ where as I used to get /opt/appdir/ . Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)); Edit: So it seems like the random dir it is spitting