- ago
I wrote code in F#. Compiled it to dll and put that dll and FSharp.Core.dll to WL8 folder. I also installed .NET SDK 8. Though the exception in Log Viewer:

CODE:
22/06/2024 10:54:26:108 TypeLoader Error loading win.dll: Could not load file or assembly 'FSharp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. FileNotFoundException Could not load file or assembly 'FSharp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg) at System.Reflection.CustomAttribute.IsCustomAttributeDefined(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Int32 attributeCtorToken, Boolean mustBeInheritable) at System.Reflection.CustomAttribute.IsDefined(RuntimeAssembly assembly, RuntimeType caType) at WealthLab.Core.TypeLoader.LoadTypes(Assembly asm) at WealthLab.Core.TypeLoader.ConductSearch(String path, String searchPattern, Boolean avoidLoadingTypes)


Still, my code is observable in “Strategies” viewer and launchable. What’s going wrong here?
0
461
Solved
7 Replies

Reply

Bookmark

Sort
- ago
#1
https://stackoverflow.com/questions/3042253/could-not-load-file-or-assembly-fsharp-core-version-4-0-0-0
https://stackoverflow.com/questions/56328386/could-not-load-file-or-assembly-fsharp-core-version-4-6-2-0
etc.
0
- ago
#2
I am using C#, not F#. However, I think how I deploy my code will also apply to you. I assume that you are using Visual Studio 2022

Set post-build event (When to run the post-build event: When the build succeeds) to run the following script in your project properties:

CODE:
cd /D "$(ProjectDir)" dotnet publish "$(ProjectFileName)" --no-build -c "$(Configuration)" --sc false -o "C:\Program Files\Quantacula, LLC\WealthLab 8"


This will run when your project build succeeds. It will deploy/copy all files, your project requires to the WealthLab directory (Replace the WealthLab installation directory in the above script with the actual installation path on your PC).

Alternatively, you can deploy the files to a temporary directory and then copy only DLL and PDB (PDB only required if you plan to debug your code) files to the WalthLab directory like in the script below:

CODE:
cd /D "$(ProjectDir)" dotnet publish "$(ProjectFileName)" --no-build -c "$(Configuration)" --sc false -o "C:\Distribution" XCOPY /Q /H /R /Y /D "C:\Distribution\*.dll" "C:\Program Files\Quantacula, LLC\WealthLab 8" IF "$(Configuration)" == "Debug" (    XCOPY /Q /H /R /Y /D "C:\Distribution\*.pdb" "C:\Program Files\Quantacula, LLC\WealthLab 8" )


dotnet publish documentation: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish
1
Best Answer
- ago
#3
I installed the runtime.



And tried all advices from stackoverflow. And rakikatha's too. Didn't helped.

I wonder why my assembly works when F# dll is not found?

Should they be of same .NET platform?

0
- ago
#4
QUOTE:
Should they be of same .NET platform?

No, .NET Standard 2.0 assemblies should be compatible with NET Core that WL8 is based on.
0
- ago
#5
The original exception you posted seems to be searching for F# Core version 8.

The screenshot you posted in #3 shows you are trying to install .NET Framework 4.8. Did you try installing the .NET 8 SDK (https://dotnet.microsoft.com/en-us/download/dotnet/8.0)?

My guess for why your strategy still works in WL8 is that you might have installed WL8 Full Setup, which comes with included .NET runtime.
0
- ago
#6


I suppose I already have them installed. Still F# .NET assemblies are missing in WL8, but a compiled strategy works. Any other suggestions how to fix that?

Also, I can't run block strategies when there is my DLL. WL8 writes that it can't compile a strategy.
0
- ago
#7
Suggestion: in the WL8 folder, right-click on the FSharp.Core.DLL and pick Properties. Then go to the Details tab and check that the version is correct.

Another thing you could try is to download SysInternals: https://learn.microsoft.com/en-us/sysinternals/ and within you'll find procexp.exe and procexp64.exe.

You want to check that WL8 is loading the correct version of FSharp.Core.DLL as follows...

Run procexp.exe or procexp64.exe (preferably) as admin. Then go to the View menu -> Lower pane view -> DLLs checked. In the process list, click WealthLab8.exe. In the lower pane, click on the DLLs tab and scroll down to find FSharp.Core.DLL which is hopefully present. Right click on that and pick Properties. Go to the Image tab to check the DLL version.

Aside: A reference to an FSharp module and a call to it worked fine for me. And, block strategies have no problem generating, compiling and running.
0

Reply

Bookmark

Sort