<small id='jPm9z'></small><noframes id='jPm9z'>

    <legend id='jPm9z'><style id='jPm9z'><dir id='jPm9z'><q id='jPm9z'></q></dir></style></legend>
  1. <i id='jPm9z'><tr id='jPm9z'><dt id='jPm9z'><q id='jPm9z'><span id='jPm9z'><b id='jPm9z'><form id='jPm9z'><ins id='jPm9z'></ins><ul id='jPm9z'></ul><sub id='jPm9z'></sub></form><legend id='jPm9z'></legend><bdo id='jPm9z'><pre id='jPm9z'><center id='jPm9z'></center></pre></bdo></b><th id='jPm9z'></th></span></q></dt></tr></i><div id='jPm9z'><tfoot id='jPm9z'></tfoot><dl id='jPm9z'><fieldset id='jPm9z'></fieldset></dl></div>

      • <bdo id='jPm9z'></bdo><ul id='jPm9z'></ul>
      <tfoot id='jPm9z'></tfoot>

      Azure 函数,EF Core,无法加载 ComponentModel.Annotations 4.2.0.0

      时间:2023-10-05

      • <bdo id='7lu9l'></bdo><ul id='7lu9l'></ul>
        <legend id='7lu9l'><style id='7lu9l'><dir id='7lu9l'><q id='7lu9l'></q></dir></style></legend>

        • <tfoot id='7lu9l'></tfoot>

          <i id='7lu9l'><tr id='7lu9l'><dt id='7lu9l'><q id='7lu9l'><span id='7lu9l'><b id='7lu9l'><form id='7lu9l'><ins id='7lu9l'></ins><ul id='7lu9l'></ul><sub id='7lu9l'></sub></form><legend id='7lu9l'></legend><bdo id='7lu9l'><pre id='7lu9l'><center id='7lu9l'></center></pre></bdo></b><th id='7lu9l'></th></span></q></dt></tr></i><div id='7lu9l'><tfoot id='7lu9l'></tfoot><dl id='7lu9l'><fieldset id='7lu9l'></fieldset></dl></div>
            <tbody id='7lu9l'></tbody>

              • <small id='7lu9l'></small><noframes id='7lu9l'>

              • 本文介绍了Azure 函数,EF Core,无法加载 ComponentModel.Annotations 4.2.0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我创建了几个 .Net Standard 2.0 库,通过控制台应用程序测试了执行,以及几个测试 - 一切都很好.

                I have created several .Net Standard 2.0 libraries, tested the execution via a console application, as well as several tests - all is good.

                移动到 azure 函数,并得到以下运行时错误:

                Move over to azure function, and get the following run-time error:

                然后我尝试将该特定版本下载到 API Function 项目中:

                I then try to download that specific version into the API Function project:

                我正在使用 Visual Studio 15.7.0 预览版 5.0.我已将 Azure Function 更新到 4.7...,因为控制台和测试项目是 - 并且这些工作正常.

                I'm using Visual Studio Version 15.7.0 Preview 5.0. I have updated the Azure Function to 4.7... as the console and test projects are - and those work.

                已经在这个太多小时.. 所以我希望决议不是什么疯狂.Ef Core 2.1.0-rc1-final 也在其中.对Required、MaxLength、NotMapped 使用数据注解.

                Been at this a far too many hours.. so I'm hoping the resolution isn't something crazy. Ef Core 2.1.0-rc1-final is also in the mix. Using data annotations for Required, MaxLength, NotMapped.

                图形错误 说:Microsoft.EntityFrameworkCore:无法加载文件或程序集System.ComponentModel.Annotations,版本=4.2.0.0

                Error in graphic says: Microsoft.EntityFrameworkCore: Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.2.0.0

                推荐答案

                我建议在启动 Azure Function 后在下面运行此函数.它将任何程序集重定向到现有版本.

                I would suggest running this function below once you start your Azure Function. It will redirect any assembly to an existing version.

                public class FunctionsAssemblyResolver
                {
                    public static void RedirectAssembly()
                    {
                        var list = AppDomain.CurrentDomain.GetAssemblies().OrderByDescending(a => a.FullName).Select(a => a.FullName).ToList();
                        AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
                    }
                
                    private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
                    {
                        var requestedAssembly = new AssemblyName(args.Name);
                        Assembly assembly = null;
                        AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
                        try
                        {
                            assembly = Assembly.Load(requestedAssembly.Name);
                        }
                        catch (Exception ex)
                        {
                        }
                        AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
                        return assembly;
                    }
                
                }
                

                这篇关于Azure 函数,EF Core,无法加载 ComponentModel.Annotations 4.2.0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:测试大容量 SMTP 电子邮件发送代码的最佳方法? 下一篇:如何修改在 Azure Functions 中本机注入的 IConfiguration

                相关文章

                <legend id='SwOid'><style id='SwOid'><dir id='SwOid'><q id='SwOid'></q></dir></style></legend>
                <tfoot id='SwOid'></tfoot>

                • <bdo id='SwOid'></bdo><ul id='SwOid'></ul>
                1. <i id='SwOid'><tr id='SwOid'><dt id='SwOid'><q id='SwOid'><span id='SwOid'><b id='SwOid'><form id='SwOid'><ins id='SwOid'></ins><ul id='SwOid'></ul><sub id='SwOid'></sub></form><legend id='SwOid'></legend><bdo id='SwOid'><pre id='SwOid'><center id='SwOid'></center></pre></bdo></b><th id='SwOid'></th></span></q></dt></tr></i><div id='SwOid'><tfoot id='SwOid'></tfoot><dl id='SwOid'><fieldset id='SwOid'></fieldset></dl></div>
                  1. <small id='SwOid'></small><noframes id='SwOid'>