如何在我的项目中使用automapper.net4 DLL [英] How to use automapper.net4 DLL in my project
本文介绍了如何在我的项目中使用automapper.net4 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个带有pjsip4net的应用程序(它是一个开源项目SoftPhone)。
我将AutoMaper.Net4 DLL添加到项目中的引用。
但是当我运行此代码以获取项目的程序集AutoMapper.Net4它不在列表中。为什么?
I am developing a App with pjsip4net (it is an open source project SoftPhone) .
I add AutoMaper.Net4 DLL to references in the project .
but when I run this code to get project's assemblies AutoMapper.Net4 it is not in list . why ?
AppDomain currentDomain = AppDomain.CurrentDomain;
Assembly[] assems = currentDomain.GetAssemblies();
我尝试过:
如何在我的项目中使用AutoMapper.Net4 DLL
What I have tried:
How to use AutoMapper.Net4 DLL in my project
推荐答案
如果您参考文档, AppDomain.GetAssemblies Method(System) [< a href =https://msdn.microsoft.com/en-us/library/system.appdomain.getassemblies(v=vs.110).aspx\"target =_ blanktitle =New Window> ^ ],它读取,获取已加载到此应用程序域的执行上下文中的程序集。
添加引用实际上并不加载程序集。您必须在代码中使用它才能加载它。
如果您在项目中添加了引用,则不要使用Reflection来加载它,只需创建一个新的类实例并从那里开始。
If you refer to the documentation, AppDomain.GetAssemblies Method (System)[^], it reads, "Gets the assemblies that have been loaded into the execution context of this application domain."
Adding a reference does not actually load the assembly. You would have to be using it in code somewhere for it to get loaded.
If you added a reference in your project then don't use Reflection to load it, just create a new instance of the class and go from there.
这篇关于如何在我的项目中使用automapper.net4 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文