I upgraded Microsoft.AspNetCore from 2.0.3 to 2.0.5 and my WebAPI project, although running successfully locally, fails to start in production (IIS). Everything was fine in
In most case you get that error because there's misalignment of versions.
I changed the Microsoft.VisualStudio.Web.CodeGeneration.Design
version, an it worked.
Before
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" />
After
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.4" />
To solve the first half of the error message, An assembly specified in the application dependencies manifest (…) was not found
be sure to always use the publish output when deploying to a target sever.
For a self-contained application it can be found in
bin\Release\netcoreapp2.0\win81-x64\publish
or for framework-dependent deployments in
bin\Release\netcoreapp2.0\publish
The output in the directories above are meant to be used in development only, since they are specific to machine and user configuration built with.
Taken from a related answer.
Development machines usually have the SDK installed but on production the runtime only.
Add the following to your .csproj file and publish again.
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>