如何制作 C# win 服务应用程序来引用主机中的程序集
我正在 C# 中构建代理服务,以与主机上安装的 SCVMM 进行通信。为此,代理引用以下程序集:Microsoft.SystemCenter.VirtualMachineManager.dll 和 Erros.dll 等。
在 Visual Studio 开发环境中,我添加了对代理应用程序的引用。当我在调试/发布模式下构建时,基本上我不会将上述程序集复制到调试/发布目录,因为代理将分发给客户。基本上代理应用程序与SCVMM通信,在安装代理应用程序之前必须安装SCVMM。
我不明白的一件事是如何使代理服务引用
文件夹中已存在的 Microsoft.SystemCenter.VirtualMachineManager.dll 等文件。
I am building an agent service in C# to communicate with SCVMM installed on host. To do that the agent refers the following assemblies: Microsoft.SystemCenter.VirtualMachineManager.dll and Erros.dll etc.
In visual studio dev environment, I have added references to the agent app. When I build in debug/release mode basically I don't the above assemblies to be copied to debug/release directory, since the agent will distributed to customers. Basically agent app communicates with SCVMM, SCVMM must have been installed before installing the agent app.
One thing that I don't understand is how to make the agent service to refer Microsoft.SystemCenter.VirtualMachineManager.dll etc files that are already existing at <SCVMM root>/bin
folder.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Visual Studio 中以及在调用 dll 调用中的任何方法之前正常引用:
您也可以在
yourapp.exe.config
文件中执行此操作(请参阅 将自定义路径设置为引用的DLL?)但是由于您的路径与可执行文件无关,这意味着生成安装程序中的.config
文件。Reference as normal in visual studio and before calling any method in the dll call :
You could also do it in the
yourapp.exe.config
file (See Set Custom Path to Referenced DLL's? ) But as your path isn't relative to the executable that would mean generating the.config
file in your installer.