I have an ASP.NET Core 6 app deployed in Azure AppService. After I updated Serilog.AspNetCore
to 7th version it started crashing with:
Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0
(issue occurs only in AppService, locally everuthing works fine)
I suspect that deployment process cleans up dll's from .NET SDK similar to Azure Functions deployment flow. In Azure Functions this issue can be resolved with
<FunctionsPreservedDependencies Include="Microsoft.Extensions.Logging.Abstractions.dll" />
or
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
Is there something similar for AppService?
Note: After downgrading the package to 6th version, everything works fine
Note 2: I don't have access to
Advanced Tools
, so cannot verify what files are being deployed (restricted by my company's DevOps)
Edit: Here's my csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>1bcc1cf7-6fce-4196-9bb5-a7aa29a04078</UserSecretsId>
<RootNamespace>MyApp</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.13" />
<PackageReference Include="Serilog.Sinks.Splunk" Version="3.7.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyApp.AppCore\MyApp.AppCore.csproj" />
</ItemGroup>
</Project>