After opening a ticket and discussing it with MS technical support, we were able to resolve this by uninstalling/reinstalling Net Core SDK 2.1. Why a function app that targets 3.1 would need 2.1 SDK installed at all is still a mystery, but my problem is solved.
Azure Functions quit building with error after upgrading Visual Studio to 16.8.5
My Azure functions target x64 specifically due to some native dependencies. I have one that targets v1 (due to a Framework dependency) and one that is v3.
The error message is the same for both of them and only began on my local system after I upgraded to Visual Studio 16.8.5. Initially, the build would freeze indefinitely, but after clearing all nuget packages, it consistently gives an error now. None of my peers are seeing the problem on their machines.
Function v1 error:
.nuget\packages\microsoft.net.sdk.functions\1.0.38\build\Microsoft.NET.Sdk.Functions.Build.targets(44,5): error :
Error:
An assembly specified in the application dependencies manifest (Microsoft.NETCore.App.deps.json) was not found:
package: 'runtime.win-x64.Microsoft.NETCore.App', version: '2.1.25'
path: 'runtimes/win-x64/lib/netcoreapp2.1/System.ComponentModel.DataAnnotations.dll'
error : Metadata generation failed.
Function v3 error:
Metadata generation failed. Exit code: '-2147450740' Error: 'Error: An assembly specified in the application dependencies manifest (Microsoft.NETCore.App.deps.json) was not found: package: 'runtime.win-x64.Microsoft.NETCore.App', version: '2.1.25' path: 'runtimes/win-x64/lib/netcoreapp2.1/System.ComponentModel.DataAnnotations.dll''
Steps I have tried:
- Repair VS
- Update to preview version.
- Uninstall and reinstall 16.7
- Reset my repository
- Cleared all nuget packages
If I cannot solve this soon, my final resort will be a full system reset...
2 answers
Sort by: Most helpful
-
-
MayankBargali-MSFT 70,536 Reputation points
2021-02-16T09:44:18.507+00:00 Hi @Aaron Peavy
Welcome to Microsoft Q&A! Thanks for posting the question.
As per the error message looks like you are referencing the 2.1.25 of Microsoft.NETCore.App but this version was not found.
An assembly specified in the application dependencies manifest (Microsoft.NETCore.App.deps.json) was not found:
package: 'runtime.win-x64.Microsoft.NETCore.App', version: '2.1.25'
path: 'runtimes/win-x64/lib/netcoreapp2.1/System.ComponentModel.DataAnnotations.dll'
error : Metadata generation failed.Can you verify the version of System.ComponentModel.DataAnnotations referred in your project. Also, verify your .csproj file and see the PackageReference version for this.
The suggestion would be to update the same version of System.ComponentModel.DataAnnotations that is referred to in your application dependencies.