无法加载文件或程序集'netstandard'或其依赖项之一



我将解决方案 ElasticSearch.net 和嵌套库升级到 7.1.0 版本。 部署代码后,我收到以下错误:

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

我尝试将库复制到我部署的服务器,但这不起作用。

升级详情: 1.(ElasticSearch.net 5.6.1 至 7.1.0

2.(嵌套 5.6.1 到 7.1.0

3.( .已安装网络框架 4.7.3

4.( VS2017

从 NuGet 包管理器升级。

通过在csproj文件中手动添加netstandard库的引用,该问题已得到解决,如下所示:

<Reference Include="netstandard">
<Private>True</Private>
</Reference> 

上述解决方法来自 - 您必须添加对程序集"netstandard, Version=2.0.0.0"的引用

相关内容

  • 没有找到相关文章

最新更新