0

We are trying to come up with a good solution for sharing common libraries, files, executables. We have use case like below

Service1 and Service2 are two WCF services developed and maintained by two separate teams and they follow their own release schedules. Common.dll is provided by separate team and they release as per their own schedule.

When Common.dll is released beside each Service team testing it, Common team has additional responsibility to approach every service team and their by make sure those changes are dropped into multiple BIN folders and there will be a scenario where we might miss in one of the BIN folder.

Service1
Folder: C:\Services\Service1\Bin
Common.dll
Common.dll.config
Service1.dll

Service2
Folder: C:\Services\Service2\Bin
Common.dll
Common.dll.config
Service2.dll

Instead of having Common.dll and Common.dll.config into two separate Bin folders what is the best way for Service1 and Service2 refer them.

This is not like below. I do not want to have Common.dll and Common.dll.config in C:\Services\Service1\Bin and also C:\Services\Service2\Bin

How do I keep common code shared between projects in c#?

Working with Common/Utility Libraries

Just started research is it possible ?

UPDATE

I researched many ways but if I do not have dlls in my BIN folder of my service, I am unable to start my service. So it seems I need to have all my dlls in my BIN folder. So I wrote a method which runs in OnStart event of my windows service which is hosting my WCF service to copy files from common location to my BIN folder.

Instead of blindly copying the DLL, I am trying to compare DLL from common folder to my BIN folder DLL and if not same then copy from Common folder and replace in BIN folder. Any suggestions how to compare two dlls in C# code?

protected override void OnStart(string[] args)
{
  try
  {
      LoadAssemblies();
      restServiceHost = new ServiceHost(typeof(restService.NonVaseImage));
      restServiceHost.Open();
  }
  catch (Exception ex)
  {
     \\handle exception
  }
}
Ziggler
  • 3,361
  • 3
  • 43
  • 61
  • 1
    Good solution is to use NuGet... Based on post what you trying to do is patch DLL in deployed app... which does sound like recipe for disaster when you randomly patch with incompatible version or you can't ever patch as supported versions of common library don't match between services. Consider only deploying from the build and never patching deployed code manually by overwriting just some files... – Alexei Levenkov Jan 21 '20 at 21:39
  • Even if you do NuGet, they will end up in BIN folder. Now we have a huge massive .NET Remoting service that we decided to convert into WCF Rest service and we need to get everyone on board and few people are strongly against saying now common library will endup in multiple BINs and they are not even agreeing to NuGet solution. They asking show a solution where Common.dll is in one folder and other WCF services will use it but Common.dll must not end up in BIN folders. – Ziggler Jan 21 '20 at 21:44
  • They want to avoid approaching each team when they make changes. They say they make changes and they will drop DLL in one location and thats it. They do not want NuGet packages and all that noise. – Ziggler Jan 21 '20 at 21:45

0 Answers0