An assembly specified in the application dependencies manifest (...) was not found
asp.net Core.Net Coreasp.net Web-Api2UpgradeNuget Packageasp.net Core Problem Overview
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 production until this upgrade. The error message produced in the log directory is as follows:
Error:
An assembly specified in the application dependencies manifest (MyProject.WebAPI.deps.json) was not found:
package: 'Microsoft.AspNetCore.Mvc.Abstractions', version: '2.0.2'
path: 'lib/netstandard2.0/Microsoft.AspNetCore.Mvc.Abstractions.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
aspnetcore-store-2.0.5.xml
Could someone explain to me the details of exactly what this means? I assume it's a version mismatch of sorts, but why is this occurring? I thought the latest stable releases of NuGet packages weren't supposed to have such issues.
I was able to resolve the issue by downgrading Microsoft.AspNetCore.All from 2.0.5 to 2.0.3, but would like to find a better solution to the issue so I can use the most up-to-date version of this package.
asp.net Core Solutions
Solution 1 - asp.net Core
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>
Solution 2 - asp.net Core
Sometimes this is related to the Startup Project, For example if the migration is a class library in Azure Functions project. You have to make sure when you run Add-Migration while the EF Library project is selected as Startup Project.
Solution 3 - asp.net Core
For me, the marked answer didn't solve the issue. My issue was when trying to Add-Migration
Add-Migration -Name initial-migration -Context Mysln.Data.MyDbContext -StartupProject Mysln -Project Mysln.Core
I solved it by downgrading all my Entityframework packages to 2.0.0 instead of the latest 2.2.0-preview one.
Solution 4 - asp.net Core
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.
Solution 5 - asp.net Core
If you have more than one project in your solution like me:
and if you want to scaffold dbcontext in your "non startup" project (InstantOrder.Functions.Data in my case)
then you should add the -StartupProject
parameter of the Scaffold-DbContext
command like this -
Scaffold-DbContext "Server=..." -Project InstantOrder.Functions.Data -StartupProject InstantOrder.Functions.Data
Solution 6 - asp.net Core
2 cents: If you just take from the build folder, the dlls for the dependency aren't provided. If you publish the folder, they are. This was the fix for me.
Solution 7 - asp.net Core
I had this error however my solution was somewhat different from what was posted above. My problem was that I was deploying via a zip file and while building the zip file I wasn't including sub directories therefore required files were not being included.
So if you are publishing via a zip file make sure to include all sub folders while building the zip.
Solution 8 - asp.net Core
I got this error while running Scaffold-DbContext
command on the Library project.
Solution:
- Remove the Azure Function project from the solution, and then run this command.
- After that, use add an existing project feature to add the Azure Function project again in the solution.
Solution 9 - asp.net Core
The correct .NET Core runtime was not installed on my PC. I had NETCore.App 2.1 and 2.2, but the project was targeted to 2.0.
dotnet --list-runtimes
I installed the correct runtime from the dot.net site and it resolved the issue.
Solution 10 - asp.net Core
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" />
Solution 11 - asp.net Core
This happened to me when I published my Lambda to AWS after renaming the project. I deleted both the obj and bin folders, rebuilt, republished and that fixed it.