@Anonymous , Welcome to Microsoft Q&A, you could try the following steps to call the method in ProjectA from ProjectB.
First, Please write the code example in One Project:
public class Student
{
public void SayHello()
{
Console.WriteLine("Hello, world");
}
}
Second, Please right click your References in your visual studio, then click Add reference:
Third, If your projects are in the same solution, you could switch to Projects, then choose the desired project:
If your projects are not in the same solution, you could click Browser.. to find the exe or dll file about another file.
Then, you could call the method in the current project:
using ConsoleApp1;
namespace ConsoleApp2
{
internal class Program
{
static void Main(string[] args)
{
Student student = new Student();
student.SayHello();
}
}
}
Hope the above steps could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.