0

Can I use one C# class library project to create many dll files like:

using System;
using System.IO;
namespace ClassLibrary
{
    public class Class1
    {
        static public void Test(int a, int b)
        {
            for (int i = 1; i <= 3; i++)
            {
                //
                //  Same Code
                //
                if (i == 1) { /*......*/}
                if (i == 2) { /*......*/}
                if (i == 3) { /*......*/}
                //
                //  Same Code
                //

                //rename dll from ClassLibrary.dll to ClassLibrary#.dll
                File.Move("...//ClassLibrary.dll", "...//ClassLibrary" + i.ToString() + ".dll");  
            }
        }
    }
}

Or other way that I can write "same code" area only once but achieve this goal?

DaveG
  • 491
  • 1
  • 6
  • 19
  • One way is to create multiple projects and add the existing file as the reference to all project to avoid the duplication. So When you build the dll for each project will be created. – Mittal Patel Mar 01 '18 at 07:22
  • In visual studio there is linking files to another projects so one source mutiple projects possible.. If i understood truely the question ;) – kanpinar Mar 01 '18 at 08:10

0 Answers0