Home

Force LINQPad to reload DLL

edited September 2019
I have a script that creates DLL on the fly, puts it into a local folder, and the rest of the script is using that DLL like this:

//set custom parameters for DLL
//create DLL in local folder
//use that DLL

The script has referenece to this DLL.

I know the way I do it looks weird but I need exactly this.
Script works well and the DLL is successfully created in the local folder but if I change custom parameters at step #1 and re-run, script would still use old DLL because it actually uses the *copy* of the dll located in the LINQPad temp folder. How can I make the script use the latest one? I tried to change assembly version but this didnt help. Thanks.

Comments

  • LINQPad monitors the date/time of reference assemblies and automatically refreshes when they change. However, I'm guessing that you're not referencing this assembly and instead loading it dynamically. In which case you can force it to update with this code:

    Util.NewProcess = true;
  • Unfortunately it's not always working. I can't reproduce it with a short example but in my cuttent script this doesn't work.
    My script does update the DLL (which is permanently referenced, not dynamically loaded) but on the next run it's still using older version. What is interesting is that newly added classes are showing well in the script, but still getting "Couldn't load type XXX from assembly YYY" error.
    This could help me if I knew more about how and at what moments LINQPad checks local dll for updates.
Sign In or Register to comment.