首页 \ 问答 \ 在运行时动态加载程序集依赖关系的问题(Problems loading assembly dependencies dynamically at run-time)

在运行时动态加载程序集依赖关系的问题(Problems loading assembly dependencies dynamically at run-time)

让我试着解释我的问题。 我目前正在尝试开发一个用.Net编写的小型“插件框架”(主要用于实验)。 所以这个想法是通过在主应用程序的特定文件夹“插件”中部署dll来创建一个可以添加“插件”的主应用程序。 一切正常,插件正确实例化,但现在我面临一个问题。 我现在部署了一个插件“X”,它使用了额外的第三方插件,所以现在我遇到了这样的问题:在运行时找不到“X”所需的其他第三方插件。 我的想法现在是添加一个额外的目录“依赖关系”,我也部署了所有需要的插件。

所以我的第一个问题是:如何将程序集加载到应用程序域中(假定我知道它们的路径),它们可以被我的应用程序使用?

我试图通过做类似的事情来解决这个问题:

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
    //find the path to the assembly and then load and return it by
    //return Assembly.Load("pathToDependencies/failedAssembly.dll");
}

问题是这个事件处理程序现在被激活并在args变量中使用“Presentation.Zune.dll”(我正在使用WPF应用程序)。 好像那个程序集加载失败但实际问题是另一个dll。

有人可以建议我一个更好的方法来解决我的问题吗? 我希望我能够充分解释我的情况,否则只是要求进一步澄清。

谢谢,Juri


let me try to explain my problem. I'm currently trying to develop a small "plugin-framework" written in .Net (mainly for experimenting a bit). So the idea is to have a main application to which "plugins" can be added by deploying dlls in a specific folder "plugins" of the main application. Everything works fine, the plugins are instantiated properly, however now I'm facing a problem. I have deployed now a plugin "X" that uses additional 3rd-party plugins and so now I have the problem that these additional 3rd-party plugins required by "X" are not found at run-time. My idea is therefore now to add an additional directory "dependencies" where I also deploy all of the needed plugins.

So my first question: How can I load the assemblies into the application domain (given that I know the path to them) s.t. they can be used by my application?

I tried to approach that by doing something like:

AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);

System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
    //find the path to the assembly and then load and return it by
    //return Assembly.Load("pathToDependencies/failedAssembly.dll");
}

The problem is that this event-handler now gets activated having the "Presentation.Zune.dll" in the args variable (I'm using a WPF app). It seems as if that assembly failed loading but the actual problem is another dll.

Can someone suggest me a better way to solve my problem? I hope that I was able to explain my situation sufficiently, otherwise just ask for further clarification.

Thanks, Juri


原文:https://stackoverflow.com/questions/592681
更新时间:2024-04-13 15:04

最满意答案

只要没有错误, FIRAuth.auth()?.createUserWithEmail将立即创建用户,那么就不需要

// Create Firebase User
let userData = ["provider" : "email", "password": password!]
DataService.ds.createFirebaseUser(user!.uid, user: userData)
print("firebase user created!")
self.loginUser()

检查您的Firebase控制台以查看用户是否已创建


As long as there is no error, FIRAuth.auth()?.createUserWithEmail will create the user immediately, there would be no need for

// Create Firebase User
let userData = ["provider" : "email", "password": password!]
DataService.ds.createFirebaseUser(user!.uid, user: userData)
print("firebase user created!")
self.loginUser()

check your firebase console to see if users have been created

相关问答

更多
  • 尝试使用: try! FIRAuth.auth()!.signOut() 这是我在IBAction中的代码,它工作得很好: try! FIRAuth.auth()!.signOut() if let storyboard = self.storyboard { let vc = storyboard.instantiateViewControllerWithIdentifier("firstNavigationController") as! UINavigationController ...
  • 从我从JSON响应中可以看到, parseJSON["status"]是HTTP statusCode,它是一个数字状态代码。 200是成功,400是坏请求,404是未找到,500是错误。 您可以从字典中读取消息,也可以根据PHP代码的工作方式将状态转换为Integer,并在状态为200时仅进行segue。对于任何其他状态代码,您可能希望向用户显示消息。 这取决于您是否故意根据结果返回状态代码,例如,状态代码401 未经授权 。 正确使用状态代码比比较字符串要可靠得多。 编辑: import Foundat ...
  • 只要没有错误, FIRAuth.auth()?.createUserWithEmail将立即创建用户,那么就不需要 // Create Firebase User let userData = ["provider" : "email", "password": password!] DataService.ds.createFirebaseUser(user!.uid, user: userData) print("firebase user created!") self.loginUser() 检查 ...
  • 我认为在应用程序中(_ application:UIApplication,open url:URL,sourceApplication:String?,annotation:Any) - > Bool,你需要得到GIDSignIn.sharedInstance()。handle的结果(url,sourceApplication:sourceApplication,annotation) :注释)并将其与FB一起返回。 所以它应该是这样的: return handled || GIDSignIn.share ...
  • 您可以在旧网站上登录。 但是,似乎firebase 在可预见的未来强制要求谷歌帐户。 You can login here on the older site. However, it seems like firebase is making google accounts mandatory for the foreseeable future.
  • 您通常希望在Swift代码和服务器端安全规则中添加验证,但原因各不相同。 您必须在服务器上进行验证,因为它是恶意客户端无法绕过的唯一验证类型。 此验证是您防止错误数据的最后一道防线。 您可能还想验证客户端上的数据。 这更像是为您的用户提供的服务:如果您在客户端上进行验证,则可以根据您的规则向他们提供有关其数据是否有效的早期(通常更好)消息。 You'll typically want to add validation both in your Swift code and in your server-s ...
  • 我设法让它运作起来。 事实证明,firebase网站上的视频解释了哪些依赖项已经过时了。 我在页面下面进一步阅读,看到firebase实际上需要两个我缺少的依赖项。 添加libc++.dylib , libiucore.dylib , CFNetwork.framework , Security.framework和SystemConfiguration.framework一切正常。 I managed to get it working. It turns out that the video on th ...
  • 可能有一些事情出错了, 您没有安装Firebase / auth pod。 firapp没有完成自我配置,你正在调用一个firebase函数。 我认为最有可能是第一个。 在这种情况下,打开podfile并添加pod'Firebase / Auth' 这个问题是通过不安装所有的Firebase功能/ pod解决的。 There may be a couple of things that went wrong, You did not install firebase/auth pod. The firapp ...
  • 我的逻辑如下有效。 另外,请确保您没有在storyboard Segues并忘记的任何Segues 。 //this checks 3 fields that they are filled and not empty if passwordTextField.text == "" || emailTxt.text == "" || usernameTextField.text == ""{ simpleAlert(mess: "You must fill all fie ...
  • 请不要使用电子邮件地址作为密钥。 电子邮件地址是动态的,可能会发生变化(如果用户想要更改它们),如果他们这样做,您将手上一团糟,因为直接使用该电子邮件的每个节点都将被删除并重新创建。 最佳做法是将密钥与其包含的数据解除关联。 这是要使用的结构 emails -Yiaisjpa90is email: "dude@test.com" -Yijs9a9js09a email: "thing@test.com" 然后,您只需在电子邮件节点中查询您要查找的电子邮件,并相应处理(如果存在)。 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)