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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Reference C# DLL in Sublime Text 2?

  • 21-07-2015 5: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, Registered Users 2 Posts: 7,501 ✭✭✭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, Registered Users 2 Posts: 7,501 ✭✭✭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,242 Mod ✭✭✭✭L.Jenkins




  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,040 ✭✭✭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, Registered Users 2 Posts: 2,040 ✭✭✭Colonel Panic


    Maybe...


  • Administrators Posts: 54,424 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