ASP.NET Core Logging Azure Site Extension causes 500.30 ANCM Startup Error
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
After re-publishing a site to an Azure App Service **without making code changes**, this error was thrown and caused the site to go down with a 500.30 ANCM startup error:
```
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
```
Our project depends on Serilog.AspNetCore which depends on `Microsoft.Extensions.Logging.Abstractions`.
The project is targeting .Net 7: `net7.0` and the app service is configured in Azure to use .Net 7:

Removing the ASP.NET Core Site Extension fixed the issue without republishing the application.
Looking at the source code of [Logging.AzureAppServices](https://github.com/dotnet/aspnetcore/blob/main/src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj) I do see that it includes `` as well.
### Expected Behavior
Republishing a site without changing any code should not cause the site to go down due to the automatically installed ASP.NET Core Logging site extension
### Steps To Reproduce
N/a
### Exceptions (if any)
```
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
```
### .NET Version
7.0.203
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.