Page 1 of 1

System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource

Posted: Thu 21 Apr 2022 14:30
by fjbelizon
Hi. I have a web application on .NET Framework 4.8 that uses dotConnect for Oracle version 9.11.951. This application has an EDML object to map the Oracle objects that we are going to use.

When I compile and execute the app locally, with Visual Studio 2019, everything works fine. But, if I compile with an Azure DevOps pipeline, when I execute the app it generates a runtime error of type "System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource".

Can you tell me why this problem occurs? How do I solve it? Thanks in advance.

The pileline have this tasks:
- NuGet tool installer.
- NuGet (for restore packages).
- Visual Studio Build.
- Publish Build Artifacts.

The exception stacktrace is:

System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource.
at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Entity.Core.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.SplitPaths(String paths)
at System.Data.Entity.Core.Common.Utils.Memoizer`2.<>c__DisplayClass4_0.<Evaluate>b__0()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Entity.Core.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetArtifactLoader(DbConnectionOptions effectiveConnectionOptions)
at System.Data.Entity.Core.Metadata.Edm.MetadataCache.GetMetadataWorkspace(DbConnectionOptions effectiveConnectionOptions)
at System.Data.Entity.Core.EntityClient.EntityConnection.GetMetadataWorkspace()
at System.Data.Entity.Core.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Entity.Core.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor, ObjectQueryExecutionPlanFactory objectQueryExecutionPlanFactory, Translator translator, ColumnMapFactory columnMapFactory)
at REGLAMENTARIAModel.REGLAMENTARIAEntities..ctor() in D:\a\1\s\src\InterfazHermes\Models\InterfazHermesModel.Designer.cs:line 55
at InterfazHermes.Models.Repositories.GenericRepositoryFactory..ctor() in D:\a\1\s\src\InterfazHermes\Models\Repositories\GenericRepositoryFactory.cs:line 10
at InterfazHermes.Models.Business.ReglamentariaServicios..ctor() in D:\a\1\s\src\InterfazHermes\Models\Business\ReglamentariaServicios.cs:line 31
at InterfazHermes.ReglamentariaService.Reglamentaria(String codInspeccion, String datosXML) in D:\a\1\s\src\InterfazHermes\ReglamentariaService.asmx.cs:line 329

Re: System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource

Posted: Thu 28 Apr 2022 14:20
by Shalex
You should add a step to your pipeline for installing the provider on the build server to register the provider build action:

Code: Select all

- task: CmdLine@2
  inputs:
    script: '$(Build.SourcesDirectory)\dcoracle911pro.exe /TYPE=FULL /VERYSILENT'
Refer to https://www.devart.com/dotconnect/oracl ... yment.html > the Continuous Integration section.

Re: System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource

Posted: Tue 03 May 2022 09:00
by fjbelizon
The solution doesn't work. I'm still having the same problem

Re: System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource

Posted: Tue 03 May 2022 17:23
by Shalex
1. Make sure that the agent on your build server is running with administrator privileges.
2. Check if your pipeline actually installs the provider on the build server successfully.
3. Specify the version of Visual Studio on your build server.