Problem
In a single-file application (PublishSingleFile=true), Assembly.Location is an empty string (IL3000). BAUERGROUP.Shared.Core derives application names and folders from it in several places. In a single-file build they all come out empty or collapse into their parent folder.
Observed on 2026-09-15 with bgIndustrialAutomation Client (Shared.Core 3.0.8), published the way its release workflow does it (-r win-x64 --self-contained true -p:PublishSingleFile=true) and then started:
| What |
Expected |
Actual |
| Log file |
C:\ProgramData\<App>\Logging\<App>.log |
C:\ProgramData\Logging\.log |
ApplicationFolders.ExecutionAutomaticApplicationDataFolder |
C:\ProgramData\<App> |
C:\ProgramData (the application's settings file lands directly in C:\ProgramData) |
BGLoggerConfiguration.ApplicationName |
<App> |
empty (start banner prints --- ---) |
NLog logger name (BGLogger) |
<App> |
empty |
Sentry ApplicationName tag / Logger context property |
<App> |
empty, so Sentry.NLog drops both |
The same build run from dotnet run (not single-file) behaves correctly, so this only shows up on installed stations. Two different single-file applications on one machine also share the same log file and data folder.
Affected code (main, 02325dd)
Application/ApplicationFolders.cs:29 ApplicationBinary, :40 ApplicationFileNameWithoutExtension (and everything built on it: ExecutionApplicationDataFolder, ExecutionCommonApplicationDataFolder, ExecutionAutomaticApplicationDataFolder), :84 ApplicationExecuting
Application/ApplicationConfigurationStoreBinary.cs:98
Logging/BGLogger.cs:41 (logger name)
Logging/BGLoggerConfiguration.cs:28 (ApplicationName, which feeds the log file name, the archive name and the Sentry tag)
ErrorTracking/BGErrorTracking.cs:100 (default release name), ErrorTracking/BGErrorTrackingConfiguration.cs:18 (ApplicationName)
Suggested fix
- For names use
assembly.GetName().Name, which works in single-file builds.
- For directories use
AppContext.BaseDirectory, and for the executable path Environment.ProcessPath.
- Enable
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer> in the library, so IL3000 flags any new Assembly.Location use at build time.
- Add a test that runs the name and folder resolution with an empty
Location, or a smoke test against a single-file publish.
Impact on applications
Stations that are already installed keep their settings in C:\ProgramData\<App>.Configuration.json and their log in C:\ProgramData\Logging\.log. Once this is fixed, the folders move to the intended location. The release notes should say so, since applications may need to migrate or look in the old location once.
Problem
In a single-file application (
PublishSingleFile=true),Assembly.Locationis an empty string (IL3000). BAUERGROUP.Shared.Core derives application names and folders from it in several places. In a single-file build they all come out empty or collapse into their parent folder.Observed on 2026-09-15 with bgIndustrialAutomation Client (Shared.Core 3.0.8), published the way its release workflow does it (
-r win-x64 --self-contained true -p:PublishSingleFile=true) and then started:C:\ProgramData\<App>\Logging\<App>.logC:\ProgramData\Logging\.logApplicationFolders.ExecutionAutomaticApplicationDataFolderC:\ProgramData\<App>C:\ProgramData(the application's settings file lands directly inC:\ProgramData)BGLoggerConfiguration.ApplicationName<App>--- ---)BGLogger)<App>ApplicationNametag /Loggercontext property<App>The same build run from
dotnet run(not single-file) behaves correctly, so this only shows up on installed stations. Two different single-file applications on one machine also share the same log file and data folder.Affected code (main, 02325dd)
Application/ApplicationFolders.cs:29ApplicationBinary,:40ApplicationFileNameWithoutExtension(and everything built on it:ExecutionApplicationDataFolder,ExecutionCommonApplicationDataFolder,ExecutionAutomaticApplicationDataFolder),:84ApplicationExecutingApplication/ApplicationConfigurationStoreBinary.cs:98Logging/BGLogger.cs:41(logger name)Logging/BGLoggerConfiguration.cs:28(ApplicationName, which feeds the log file name, the archive name and the Sentry tag)ErrorTracking/BGErrorTracking.cs:100(default release name),ErrorTracking/BGErrorTrackingConfiguration.cs:18(ApplicationName)Suggested fix
assembly.GetName().Name, which works in single-file builds.AppContext.BaseDirectory, and for the executable pathEnvironment.ProcessPath.<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>in the library, so IL3000 flags any newAssembly.Locationuse at build time.Location, or a smoke test against a single-file publish.Impact on applications
Stations that are already installed keep their settings in
C:\ProgramData\<App>.Configuration.jsonand their log inC:\ProgramData\Logging\.log. Once this is fixed, the folders move to the intended location. The release notes should say so, since applications may need to migrate or look in the old location once.