//Step 1: Create the Private Assembly (Class Library)
//Open Visual Studio → Create a new project → select Class Library (.NET Framework).
//Name it: MyMathLibrary.
//Replace the default class code with:
using System;
namespace MyMathLibrary
{
public class MathOperations
{
public int Add(int a, int b)
{
return a + b;
}
public int Multiply(int a, int b)
{
return a * b;
}
}
}
//Build the project → This generates MyMathLibrary.dll in bin\Debug\net6.0\.
//Step 2: Create the Console Application
//Open Visual Studio → Create a new project → Console App.
//Name it: UseMyMathLibrary.
//Step 3: Add Reference via Dependencies
//In Solution Explorer, expand the console app project (UseMyMathLibrary).
//Right-click Dependencies → Add Project Reference -> Browse -> MyMathLibrary->bin->Debug->.dll
//Check MyMathLibrary → click OK
//Step 4: Use the Assembly in Your Console App
using System;
using MyMathLibrary;
class Program
{
static void Main()
{
MathOperations math = new MathOperations();
int sum = math.Add(10, 20);
int product = math.Multiply(5, 4);
Console.WriteLine("Sum: " + sum);
Console.WriteLine("Product: " + product);
}
}