IL3001: Avoid accessing Assembly file path when publishing as a single file
| Value | |
|---|---|
| Rule ID | IL3001 |
| 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.GetFile(s) methods for
assemblies embedded inside the single-file bundle always throws an exception, as these methods are not single-file compatible.
How to fix violations
To embed files in assemblies in single-file bundles, consider using embedded resources and the Assembly.GetManifestResourceStream method.
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.
Feedback
Submit and view feedback for