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.)
This is now available in LINQPad 6:
https://www.linqpad.net/LINQPad6.aspx
-
Adam Ralph commented
This issue should probably be merged with https://linqpad.uservoice.com/forums/18302-linqpad-feature-suggestions/suggestions/211578-include-another-cs-file-s-in-a-linq-file
or at least, the votes of both should be counted together.
-
Piotr Owsiak commented
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
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
-
andy qi commented
#include "myotherscript.linq"
Great!That's what I need. -
Alan Hemmings commented
Just found that this is a duplicate of duplicate of http://linqpad.uservoice.com/forums/18302-linqpad-feature-suggestions/suggestions/211578-include-another-cs-file-s-in-a-linq-file
(That suggestion already has 343 votes, so will be moving my votes off this, onto that one. )
-
Brandon Bernard commented
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
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
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
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 includethe best option here is clearly
4) #include "myotherscript.linq"
It seems like low-hanging very useful fruit.