Home

LinqPad 6 doesn't load my local dll referenced in the script

edited September 8

I reference my local dll in the script. However, the linqpad 6 doesn't load the dll from the folder I specify, instead, it load it from my nuget folder, which is a different version.

For example: in my script, I reference the Microsoft.COmmerce.Model.Contract.dll in folder d:\Code\Git\COST\Catalog\Commerce.Catalog\bin\Debug

In the VS Modules windows, I can see the script is actually loading the dll from my nuget folder.

My Linqpad version and environment

Comments

  • This can happen when the DLL that you're referencing (Microsoft.Commerce.Model.Contract.dll in this case) also exists in a NuGet package that you're referencing (or in any of its dependent packages).

    When this occurs, LINQPad compares the assemblies' version numbers and uses the assembly with the highest version. This is to minimize the chance of CS1705 and MissingMethodException errors.

    LINQPad determines the assembly version number as follows:

    • For managed assemblies, AssemblyName.GetAssemblyName (path).Version
    • For native DLLs, System.Diagnostics.FileVersionInfo.GetVersionInfo (path), i.e., FileMajorPart, FileMinorPart, FileBuildPart & FilePrivatePart

    If you are able to set your local build's DLL to have a higher version that the DLL in the NuGet package, your local file should win.

  • P.S. If it helps, the latest beta has a "Show Assembly Resolution Log" button in the Advanced tab of the Query Properties dialog.

Sign In or Register to comment.