Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Reference C# DLL in Sublime Text 2?

Options
  • 21-07-2015 6:37am
    #1
    Closed Accounts Posts: 2,338 ✭✭✭


    I am trying to reference a DLL that has a few classes which I need in Sublime Text 2.

    Is this possible to get the build system to pull them in?

    I'm using the following SublimeText packages

    C# Compile & Run
    CompleteSharp


Comments

  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    Im not quite sure what you mean by "Is this possible to get the build system to pull them in?"

    Whats wrong with just adding the dll as normal?


  • Closed Accounts Posts: 2,338 ✭✭✭aphex™


    I dunno how to add a DLL, I usually use Nuget in VS.

    But in Sublime Text I don't know how to add it, and therefore it doesn't recognize the classes I'm referencing.

    I tried putting the DLL and the .cs file in the same folder and compiling, that didn't seem to work.
    'Class from dll' could not be found (are you missing a using directive or an assembly reference?

    EDIT: have the correct Using statement. Just copied file from VS.


  • Registered Users Posts: 7,500 ✭✭✭BrokenArrows


    In your visual studio project right click on References and select "Add Reference...". Browse to your DLL and select it.


  • Closed Accounts Posts: 2,338 ✭✭✭aphex™


    In your visual studio project right click on References and select "Add Reference...". Browse to your DLL and select it.

    This thread is about Sublime Text. I know how to do it is VS.


  • Moderators, Computer Games Moderators, Technology & Internet Moderators Posts: 19,240 Mod ✭✭✭✭L.Jenkins




  • Advertisement
  • Registered Users Posts: 2,019 ✭✭✭Colonel Panic


    I just took a look at the C# Compile and Run plugin. It's pretty basic.

    https://github.com/chrokh/csharp-build-singlefile-sublime-text-2/blob/master/CSharpSingleFileBuild.sublime-build

    You can see from the command line that it just compiles the file using csc.exe.

    If you want to add assembly references on the command line, you need to add additional parameters.

    https://msdn.microsoft.com/en-us/library/yabyz3h4

    In short, you can't do it with C# Compile and Run.


  • Closed Accounts Posts: 2,338 ✭✭✭aphex™



    In short, you can't do it with C# Compile and Run.

    Would csc pick it up if I added the DLL to the global assembly cache?


  • Registered Users Posts: 2,019 ✭✭✭Colonel Panic


    Maybe...


  • Administrators Posts: 53,439 Admin ✭✭✭✭✭awec


    aphex™ wrote: »
    Would csc pick it up if I added the DLL to the global assembly cache?

    No.

    csc knows nothing about the GAC. You pass in an assembly name with the /lib option and it will look for that file in the current directory and in the directory where the CLR is installed.

    CLR install path is probably C:\Windows\Microsoft.NET\Framework64 but you can determine for sure from the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\InstallRoot


Advertisement