Trying to migrate the projects from .net core 2.2 to 3.1. In local debug the whole application works correctly. I've tried to publish my application on IIS. After publishing I go to the site url and see the error:
Error 500.31 - ANCM Failed to Find Native Dependencies in IIS
Common solutions to this issue: The specified version of Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
Specific error detected by ANCM: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in
dotnet --info command result:
All projects has the target framework .netcoreapp 3.1, libraries are .netstandart 2.0.
I've tried re-installing SDK, Visual Studio 2019. I've updated every nuget packages from 2.2 to 3.1.1, that are connected with Microsoft.
Hosting bundle 3.1.1 is also installed. Any ideas how to solve this problem?
UPD. The publish command:
dotnet publish $projectPath -m --no-build -c:$publishConfiguration -o $destinationPath -v q -r $targetPlatform /p:EnvironmentName=$publishEnvironment --self-contained false;
target-platform = win-x64. The hosting model is InProgress.
UPD 2. The result of dotnet list package on solution: https://gist.github.com/AndreiKhotko/60aafeb42566ac3e3fadfab2d0209dde
UPD 3. The ASP.NET Core Diagnostics generated report: https://gist.github.com/AndreiKhotko/2a193b4121c4399e0a00bfef708140da
UPD 4. Sorry, I haven't specified the whole error message. There is the last part of it (see above for the first part of it):
Failed to run as a self-contained app. If this should be a framework-dependent app, specify the appropriate framework in '*.runtime.config'.
The content of *.runtime.config:
{
"runtimeOptions": {
"tfm": "netcoreapp3.1",
"includedFrameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "3.1.1"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "3.1.1"
}
],
"configProperties": {
"System.GC.Server": true
}
}
}

dotnet list packagein the solution directory and create a gist of the results? - Martin Frøhlich16.0. Seems like these references breaks the publishing. I will check it later - Andrei KhotkoAspNetCoreModuleis not good idea. Event viewer shows the same errors. Their descriptions are useless - Andrei Khotko--self-contained falsefrom the publish command. Why do you want to disable that while choosing win-x64? That only leaves the generated binaries in inconsistency. - Lex Li