none
kaveh rahimi2 RRS feed

Answers

  • Hi kaveh rahimi123456789,

    Thank you for posting here.

    Without more details, I just make a simple example based on my guess.

    Project1: ConsoleApp5

    using System;
    
    namespace ConsoleApp5
    {
        class Program
        {
            static void Main(string[] args)
            {
            }
    
        }
        public class Class1
        {
            public static void Method1()
            {
                Console.WriteLine("Method1 if Class1");
            }
        }
    }
    


    Project2: ConsoleApp1

    In project2, add reference of this project1 ConsoleApp5.

    If they are not in a solution, click the Browse to choose the project.

    First, using this project in the code.

    using ConsoleApp5;

    And then you could call the method directly.

    Here is the code sample for your reference.

    using ConsoleApp5;
    
    namespace ConsoleApp1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Class1.Method1();
            }
        }
    }
    

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 5, 2019 7:41 AM
    Moderator

All replies

  • Please be more specific about what you're trying to do. Do you have existing code you can share so we can understand what you're trying to accomplish? Clarifying what types of projects you have would also be useful?

    Also please point a brief description of your problem in the title so people who may be able to help you will see it.


    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, April 4, 2019 9:19 PM
    Moderator
  • Hi kaveh rahimi123456789,

    Thank you for posting here.

    Without more details, I just make a simple example based on my guess.

    Project1: ConsoleApp5

    using System;
    
    namespace ConsoleApp5
    {
        class Program
        {
            static void Main(string[] args)
            {
            }
    
        }
        public class Class1
        {
            public static void Method1()
            {
                Console.WriteLine("Method1 if Class1");
            }
        }
    }
    


    Project2: ConsoleApp1

    In project2, add reference of this project1 ConsoleApp5.

    If they are not in a solution, click the Browse to choose the project.

    First, using this project in the code.

    using ConsoleApp5;

    And then you could call the method directly.

    Here is the code sample for your reference.

    using ConsoleApp5;
    
    namespace ConsoleApp1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Class1.Method1();
            }
        }
    }
    

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, April 5, 2019 7:41 AM
    Moderator