I upgraded my solutions ElasticSearch.net and nest library to 7.1.0 version. After deploying the code I am getting below error:
BadImageFormatException: Could not load file or assembly 'netstandard' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +225
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +110
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +22
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +48
i tried copying the library to the server i deployed but that doesn't work.
Upgrade Details: 1.)ElasticSearch.net 5.6.1 to 7.1.0
2.)Nest 5.6.1 to 7.1.0
3.) .NetFramework 4.7.3 installed
4.) VS2017
upgraded from nuget package manager.
The issue got resolved by manually adding the reference of netstandard library in csproj file like below:
<Reference Include="netstandard">
<Private>True</Private>
</Reference>
The above workaround is provided from - You must add a reference to assembly 'netstandard, Version=2.0.0.0
User contributions licensed under CC BY-SA 3.0