I suggest you ...

Include other scripts

I'd like to factor out some code into a script I include because I use this code across scripts. I don't want to have to compiled to an assembly and reference it because then I can't "script" it anymore.

Please include an "include" syntax or GUI setup (which will then obviously manifest itself in the .linq XML prelude.)

142 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Bent Rasmussen shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    9 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Piotr Owsiak commented  ·   ·  Flag as inappropriate

        This is something that in deed is missing, especially once you do scripting and automation with lprun.exe
        This is making me consider switching to scriptcs which has much worse experience than LINQPad.

      • Alan Hemmings commented  ·   ·  Flag as inappropriate

        Noooo, (lying on the floor crying and sobbing that Lingpad 5 did not include this feature!) why, why? why is this world so crule? <sob> <sob> <sob> Now I'm going to have to learn ruby, or worse, powershell. ;-D

      • Brandon Bernard commented  ·   ·  Flag as inappropriate

        I agree, as fantastic as LINQPad is, this is a significant feature lacking.... within 3 days of purchasing a full license copy I'm Googleing for how to do this exactly.... link to libs or re-usable classes would be far more useful than the MyExtensions.linq file that isn't even stored with all of the other Queries so it's pretty useless to rely on this in Code snippets that ARE shared...

        A simple syntax or GUI as others have mentioned, would be Awesome.

        #Include ../MyQueryLibs/LINQ2Xml.cs (or .linq if required)....

      • Alan Hemmings commented  ·   ·  Flag as inappropriate

        Also discovered today that the code you place in My Extensions actually lives in c:\users\ { you } \ my documents \ linqpad plugins \ MyExtensions.FW30.linq ( eurgh! ) These are specific to a user and can't be included in source control, or shared.

        A temporay fix perhaps could be to have the "myExtensions.linq" file live in the root folder where their linq files reside. (the folder that the user selects when he clicks "organise"? That would allow us to check in shared project extensions into source control.

      • Alan Hemmings commented  ·   ·  Flag as inappropriate

        Totally agree Bent! I'm using linqpad together with nant scripts as build tools instead of using powershell in order to keep our technology stack really thin, and I keep hitting the "wall" as you describe. Allowing linqpad scripts to reference scripts they need instead of requiring that the users MyExtensions are flooded with every possible extension means that the scripts can be keep isolated and more maintanable. (Seperation of concerns) My Extentions is great, but you start accumulating technical debt really quickly on a large project. Thanks for the suggestion! Would have used more votes if I could ;-D

      • Bent Rasmussen commented  ·   ·  Flag as inappropriate

        Let me expand a little on this:

        when you have done LinqPad scripts for a little length of time you start having a lot of scripts, many can be reused across linqpad scripts. The problem then becomes that you end up copy-pasting or reinventing the same code again in a new context.

        The solution now is this

        1) copy-paste
        2) reinvent
        3) compile to dll and include

        the best option here is clearly

        4) #include "myotherscript.linq"

        It seems like low-hanging very useful fruit.

      Feedback and Knowledge Base