How to get lprun output folder?
I hope to get path of command lprun
output folder.
e.g
every time cmd lprun LINQPad will create dll in \AppData\Local\Temp\LINQPad5\
like below photo.
thanks!
Comments
-
Try
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
-
@nescafe thanks,yes it could get path on running linq file.
but if i use clilprun
it can not return output path.e.g
if i useipconfig
, windows system can returnip infoformation
-
The output folder is dynamic, so a separate lprun cli command would refer to another directory.
You could copy the dll to a known location as part of the script, e.g.
File.Copy(Assembly.GetExecutingAssembly().Location, @"C:\Temp\LINQPadQuery.dll");
Somewhere in your main function, or echo the location at the end of your script:
Console.WriteLine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
What are you trying to achieve?
-
Thanks!
I try to make a unity, it can input .linq file path then output exe like
Linqpadless
project.
and the logic is using linqpad's clilprun
then adding the generatedLINQPadQuery.dll
to my exe,so i have to get the lprun output path. -
You could use the following script to compile the dll and get a reference to the most recent generated file in the temporary folder within the same application lifetime.
Util.Compile(@"C:\Drive\Projects\LINQPad\Queries\Sample.linq"); var path = Path.Combine(Path.GetTempPath(), "LINQPad5", $"_{AppDomain.CurrentDomain.GetData("LINQPad.InstanceID")}"); var file = new DirectoryInfo(path) .EnumerateFiles("*.dll") // Or query_*.dll .OrderBy(x => x.LastWriteTime) .Last(); file.FullName.Dump();
-
wow,it's a solution,thanks!