Home
Options

LPRun not picking up extension methods defined in "My Extensions"

I've got a LINQPad script saved as file with a ".linq" extension, which references some extension methods that I've created. This compiles and executes fine within LINQpad, but when using lprun on the command line to execute the same script, it doesn't seem to pick up the extension methods and throws an error.

A basic example to demonstrate this is below.

*My Extensions:

public static DateTime ToEasternTime(this DateTime utc)
{
var easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
return TimeZoneInfo.ConvertTimeFromUtc(utc, easternZone);
}

*test.linq*

void Main()
{
DateTime.UtcNow.ToEasternTime().Dump();
}

*LINQPad output*

10/25/2015 3:34:46 PM

*Command Line*

c:\Utils\LINQPad4\lprun.exe "test.linq"

*Command Line Output*

c:\Users\Mun\Documents\LINQPad Queries\test.linq(9,15) : error CS1061: 'System.DateTime' does not contain a definition for 'ToEasternTime' and no extension method 'ToEasternTime' accepting a first argument of type 'System.DateTime' could be found (are you missing a using directive or an assembly reference?)

Is there something additional I need to do for the extensions to be access from lprun?

Comments

Sign In or Register to comment.