[英]Replacing class reference from “built-in” assembly with out-of-band assembly using Visual Studio 2019 Preview for Mac
Background: I'm currently trying to use EF6 to connect to a MySQL database and am searching for a resolution to an error message about a type not being able to be loaded from an assembly . 背景:我目前正在尝试使用EF6连接到MySQL数据库,并正在寻找有关无法从程序集中加载类型的错误消息的解决方案。 I believe I've found a possible solution, using an out-of-band release of a different assembly that includes the class , but that solution has yielded yet another question that seems to be distinct enough from the first to be its own question (even though answering one question may answer both).
我相信我已经找到了一个可能的解决方案,使用带类的另一个程序集的带外发行版 ,但是该解决方案产生了另一个问题,该问题似乎与第一个问题截然不同,它本身就是一个问题(即使回答一个问题可能会回答两个问题)。
Question: How can I include an out-of-band assembly using Visual Studio 2019 Preview for Mac in a way that lets me use a specific class from the assembly? 问题:如何以允许我使用程序集中的特定类的方式使用Mac版Visual Studio 2019 Preview包含带外程序集? I'd like to use the 3.0 preview release of
System.Component.Annotations
to get at the AssociatedMetadataTypeTypeDescriptionProvider
class required by EF. 我想使用
System.Component.Annotations
的3.0预览版来获得EF所需的AssociatedMetadataTypeTypeDescriptionProvider
类。 When I try to follow the instructions for adding an OOB assembly and rebuild my project, an exception gets thrown indicating that the old version of a different assembly that seems to also include that class. 当我尝试按照说明添加OOB程序集并重建我的项目时,将引发异常,表明另一个程序集的旧版本似乎也包含该类。
Package Console Output: 软件包控制台输出:
Successfully installed 'System.ComponentModel.Annotations 4.6.0-preview.18571.3' to Ef2MySql
Exception: 例外:
TypeLoadException: Could not load type 'System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider' from assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
edit: I just checked that AssociatedMetadataTypeTypeDescriptionProvider
is in the NuGet package by running nuget install System.ComponentModel.Annotations -Version 4.6.0-preview.19073.11
in an unrelated, empty directory and them opening System.ComponentModel.Annotations.4.6.0-preview.19073.11/lib/net461/System.ComponentModel.Annotations.dll
with VS. 编辑:我只是通过在不相关的空目录中运行
nuget install System.ComponentModel.Annotations -Version 4.6.0-preview.19073.11
并检查它们是否打开System.ComponentModel.Annotations.4.6.0-preview.19073.11/lib/net461/System.ComponentModel.Annotations.dll
,来检查AssociatedMetadataTypeTypeDescriptionProvider
是否在NuGet包中。 System.ComponentModel.Annotations.4.6.0-preview.19073.11/lib/net461/System.ComponentModel.Annotations.dll
与VS。 However, it's not in all of the DLLs in the NuGet package. 但是,它不是在NuGet包的所有DLL中都包含。 Just the one in
net461
. 只是
net461
中的net461
。
further edit: However, adding the assembly that I verified has the class as an .NET assembly (rather than using NuGet in VS) still does not resolve the error. 进一步编辑:但是,添加我验证的程序集将其类作为.NET程序集(而不是在VS中使用NuGet)仍然无法解决该错误。
Microsoft RazorPagesMovie tutorial using sqlite instead of mysql in Visual Studio 2019 for Mac: 在Mac的Visual Studio 2019中使用sqlite代替mysql的 Microsoft RazorPagesMovie教程:
(Try to modify it to include your issue, and hopefully you may learn from it enough to help you resolve your issues with mysql) (尝试修改它以包括您的问题,希望您可以从中学到足够的知识来帮助您解决mysql问题)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.