[英]Data Access project dll is not being added to the client bin folder
Hi I am creating new project in visual studio using the following structure: 嗨,我正在使用以下结构在Visual Studio中创建新项目:
Now the way things will be referenced will be using the following structure: 现在,将使用以下结构来引用事物:
In startup I am calling the following code: 在启动时,我正在调用以下代码:
Assembly assembly = Assembly.Load(new AssemblyName("Commercify.DataAccess"));
When this code gets executed I get the following exception: 当执行此代码时,出现以下异常:
{"Could not load file or assembly 'Commercify.DataAccess, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.":"Commercify.DataAccess, Culture=neutral, PublicKeyToken=null"}
Now I am assuming that this is happening because Visual Studio does not seem to see that Commercify.DataAccess is actualy needed because its not referenced anywhere in the other projects. 现在,我假设发生这种情况是因为Visual Studio似乎没有看到Commercify.DataAccess确实是必需的,因为在其他项目的任何地方都没有引用它。 I had the exact same problem problem in a project that used csproj type of projects so it is not a dxsproj problem.
我在使用csproj类型的项目的项目中遇到了完全相同的问题,因此它不是dxsproj问题。 I had solved it by using a post build event.
我已经通过使用post build事件解决了它。
I would prefer to have a more clean solution to this if there is one. 如果有的话,我希望有一个更干净的解决方案。
Can anyone tell me how to solve the problem? 谁能告诉我如何解决这个问题?
You are loading dynamically a DLL, so Visual Studio doesn't has a clue that it needs to be copied. 您正在动态加载DLL,因此Visual Studio没有提示需要复制它。
Or you stick with the post-build events (I am working in an exact case like that and that's the best approach) or you add a reference to the project on the other projects, but it defeats the purpose of loading dynamically an assembly. 或者您坚持执行构建后事件(我正在这样的情况下工作,那是最好的方法),或者在其他项目上添加了对该项目的引用,但是这样做破坏了动态加载程序集的目的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.