Alea GPU Tutorial not compiling on VS 2015 Update 2 with FSharp.Core 4.4.0.0
Asked Answered
U

5

8

I am getting error while compiling Alea GPU Tutorial: https://github.com/quantalea/AleaGPUTutorial in Visual Studio 2015 Community Update 2 with FSharp.Core version 4.4.0.0 on a .Net 4.5 runtime.

Fody: An unhandled exception occurred: Exception: Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

StackTrace:

at Alea.CUDA.AOTCompileLogger..ctor(List`1 logs, Int32 warningCount, Int32 errorCount)
at Alea.CUDA.AOTCompileLogger..ctor()
at Alea.CUDA.AOTCompiler..ctor()
at Alea.CUDA.Fody.ModuleWeaver.Execute()
at lambda_method(Closure , Object )
at InnerWeaver.ExecuteWeavers() in c:\Code\Fody\FodyIsolated\InnerWeaver.cs:line 164
at InnerWeaver.Execute() in c:\Code\Fody\FodyIsolated\InnerWeaver.cs:line 82
Source:
Alea.CUDA
TargetSite:
Void .ctor(System.Collections.Generic.List`1[Alea.CUDA.AOTCompileLogEntry], Int32, Int32)   

It happens both in Tutorial.Cs and Tutorial.Fs project, no matter how I set up the bindingRedirect option in all possible .config files. It looks like those redirects are ignored by Fody reference loading mechanism.

However, even setting the tutorial solution to FSharp.Core 4.3.1.0 does not allow me to compile it. The error is the same.

Do you have any ideas on how to fix it?

Undershirt answered 2/4, 2016 at 11:16 Comment(10)
fsharp.github.io/2015/04/18/fsharp-core-notes.htmlYangyangtze
all recommended settings seem to be in place, except: Do not bundle FSharp.Core with a library Do not include a copy of FSharp.Core with your library or package. If you do, you will create havoc for users of your library. The decision about which FSharp.Core a library binds to is up to the application hosting of the library. The library and/or library package can place constraints on this, but it doesn’t decide it. Unfortunately Alea.* NuGet packages do have FSharp.Core 4.3.1.0 bundled with it but it is not being picked-up during build either.Undershirt
I can see a screenshot of the App.config?Yangyangtze
I have, unfortunately, only VS2012 - so I can not replicate your bug.Yangyangtze
Ping me when you have timeYangyangtze
here are both app.configs - solution level and f# project level: gist.github.com/n074v41l4bl34u/c3f722701165c5c16226f6e97278b2e9Undershirt
Hmm...let's try to go with the other hand. When you installed the FSharp.Core(Version=4.3.1.0) CopyLocal set to True?Yangyangtze
If you don't mind, we can go to the chat chat.stackoverflow.com/rooms/51909/f .There can be dialogue faster.Yangyangtze
I am having similar issue. Any news on this? Thanks.Graniah
I have run into this error as well.Poem
W
10

I've built it successfully few times but they were completely random and I could not figured out what caused error disappearing.

Perhaps it was some combination of restarting Visual Studio as administrator many times.

Also I've tried FSharp.Core.dll from different sources with random results too:

Official

In AleaGPUTutorial it is written:

Before building within Visual Studio, it is recommended that you restore the packages prior to opening the solution. This is due to a known issue of using Fody with F# projects. You can find further details about this issue in the installation manual (especially the Remarks section)).

From the Manual:

Alea GPU is implemented with F#, so it uses the F# runtime. If you use Alea GPU from C# or VB, you also need version 3.1 or higher of FSharp.Core.dll assembly. If you use Visual Studio, you can locate that assembly by navigating to Add Reference -> Assemblies -> Extensions -> FSharp.Core 4.3.1.0. Alternatively, you can add FSharp.Core NuGet package to your project.

I did exactly what is written but got only random build success again.

Last Hope

How to use FSharp.Core 4.3.0 when all you have is 4.3.1

I had lived with the naïve assumption that when you install F# 3.1, it would automatically add redirects from FSharp.Core 4.3.0.0 to 4.3.1.0, or perhaps make sure that FSharp.Core 4.3.0.0 was also available. Apparently, I've become too used to Semantic Versioning, which is definitely not the versioning scheme used for F#

Waxbill answered 30/4, 2016 at 9:10 Comment(2)
@ginkner All of these provide random results except Last Hope which I could not try.Waxbill
The above answer solved my problem with a System.TypeInitializationException in a C#-program : #40504317 .Elbe
K
0

Ok, this worked for me. All you have to do is to add Fsharp.core 4.3.1.0 to the gac.

An explanation of how to do this can be found here:

http://forum.codio.com/t/solved-could-not-load-file-or-assembly-fsharp-core-version-4-3-0-0-error/1774

Kragh answered 13/7, 2016 at 20:54 Comment(0)
S
0

I too had a similar problem when I first tried loading one of Alea 3.0.3 samples. It took me a few minutes to figure out but this worked for me and was pretty simple to run the sample files.

1) Using Visual Studio Package Manager Console ran ./paket_setup.bat provided with the sample.zip file 2) Added the FSharp.Core.dll from under the sample project solution folder ./packages/FSharp.Core/lib/net40/FSharp.Core.dll

After this the project ran without issue.

I didn't need to install anything into the GAC

Savate answered 17/8, 2017 at 3:25 Comment(0)
F
0

To solve the problem, from the Nuget Console:

Install-Package FSharp.Core -Version X

Where X is the version you require. You can check the versions here: FSharp.Core

Ensure your projects are set to x64:

enter image description here

enter image description here

Fatigue answered 9/8, 2019 at 23:14 Comment(0)
H
0

In your project files: "project name\packages\Alea.version\tools" there is a bunch of .dll files including FSharp.Core which isn't copied over by visual studio for some reason. Copy that .dll to your bin\Debug directory containing the project build and it should work fine.

Hodometer answered 11/3, 2021 at 22:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.