none
Is this possible to #using dll in C#? RRS feed

  • Question

  • In C++ CLI/CLR this is possible to #using any dll file and use all the managed classes within this dll file in the code.

    In C# you have to Add Reference and browse for the dll file.

    I want to #using the dll file in C# instead of selecting it in a browser like you can do in C++ CLI/CLR.

    Is this possible?


    Sunday, June 23, 2019 4:53 PM

Answers

  • Nope.  "Add Reference" is the way to do it in C#.  You don't have to use the dialog; you can add the reference to the .csproj file using a text editor.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, June 24, 2019 5:51 AM
  • Hi 

    Thank you for posting here.

    Based on my search, it is best for you to use using directive instead of #using in c#. If you want to know more about it, you could look at the following link.

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-directive

    Best Regards,

    Jack


    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.

    Monday, June 24, 2019 7:28 AM
    Moderator

All replies

  • Nope.  "Add Reference" is the way to do it in C#.  You don't have to use the dialog; you can add the reference to the .csproj file using a text editor.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Monday, June 24, 2019 5:51 AM
  • Hi 

    Thank you for posting here.

    Based on my search, it is best for you to use using directive instead of #using in c#. If you want to know more about it, you could look at the following link.

    https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/using-directive

    Best Regards,

    Jack


    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.

    Monday, June 24, 2019 7:28 AM
    Moderator