IL3000: Avoid accessing Assembly file path when publishing as a single file

Value
Rule ID IL3000
Category SingleFile
Fix is breaking or non-breaking Non-breaking

Cause

When publishing as a single-file (for example, by setting the PublishSingleFile property in a project to true), calling the Assembly.Location property for assemblies embedded inside the single-file bundle always returns an empty string.

How to fix violations

If the app only needs the containing directory for the single-file bundle, consider using the AppContext.BaseDirectory property instead. Otherwise, consider removing the call entirely.

When to suppress warnings

It's appropriate to silence this warning if the assembly being accessed is definitely not in the single-file bundle. This may be the case if the assembly is being loaded dynamically from a file path.