开发者

How to make a C# win service app to refer assemblies from a host machine

开发者 https://www.devze.com 2023-04-11 18:11 出处:网络
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

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 mak开发者_JS百科e the agent service to refer Microsoft.SystemCenter.VirtualMachineManager.dll etc files that are already existing at <SCVMM root>/bin folder.


Reference as normal in visual studio and before calling any method in the dll call :

AppDomain.CurrentDomain.AppendPrivatePath(scvmmroot + "/bin");

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号