'ASP.NET 5 app failed to start on test server

I'm having trouble getting an ASP.NET 5 app run outside of my dev environment. It's being installed on a test server (which has the Microsoft.AspNetCore.App 5.0.14 runtime installed) but i twont start. In the event viewer I get the following 3 errors:

Failed to start application '/LM/W3SVC/1/ROOT/MyTestWebApp', ErrorCode '0x8000ffff'.

Could not find 'aspnetcorev2_inprocess.dll'. Exception message: Error: An assembly specified in the application dependencies manifest (MyTestWebApp.deps.json) was not found: package: 'Microsoft.Data.SqlClient.SNI.runtime', version: '2.0.1' path: 'runtimes/win-x64/native/Microsoft.Data.SqlClient.SNI.pdb'

Unable to locate application dependencies. Ensure that the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the application are installed.

Here is the .csproj file of the application

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <OutputPath>bin\</OutputPath>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <OutputPath>bin\</OutputPath>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="Controllers\" />
    <Folder Include="Hubs\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.13">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.13" />
    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
    <PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="4.0.1">
      <TreatAsUsed>true</TreatAsUsed>
    </PackageReference>
    <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
    <PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.6.3" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="5.6.3" />
    <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.6.3" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\Common\MyDependancyOne\MyDependancyOne.csproj">
      <TreatAsUsed>true</TreatAsUsed>
    </ProjectReference>
    <ProjectReference Include="..\MyTestWebApp.Application\MyTestWebApp.Application.csproj" />
    <ProjectReference Include="..\MyTestWebApp.Persistence\MyTestWebApp.Persistence.csproj">
      <TreatAsUsed>true</TreatAsUsed>
    </ProjectReference>
  </ItemGroup>

  <ItemGroup>
    <Content Update="wwwroot\index.html">
      <ExcludeFromSingleFile>true</ExcludeFromSingleFile>
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

</Project>

I tried adding this to the release build but it didn't have any effect

<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>

Any clue to what could be going on?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source