Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my F# project build locally but fail on Travis?

Tags:

.net

travis-ci

f#

The build for my project is failing on Travis with the following error:

FSC: error FS0193: The module/namespace 'System.Net' from compilation unit 'System' did not contain the namespace, module or type 'WebClient'

The main project doesn't have any dependencies, and the test project doesn't depend on System.Net or WebClient, so I'm not sure how that applies here.

Everything works fine locally, so I'm assuming a version mismatch somewhere but haven't been able to identify what.

The output of my local build can be found in this text file.


Update

Following the GitHub issue created by @7sharp9 it was discovered that this is a Mono packaging bug.

The suggested workaround was to reference FSharp.Core from the NuGet package instead, which worked for me.

You may wish to only use the NuGet package when the canonical path is unavailable, as I did.

like image 458
Paul Young Avatar asked Aug 06 '15 21:08

Paul Young


People also ask

Why do some people say the F Word a lot?

As an aside, my Biology teacher in high school told my class his thoughts on people who say the F word a lot: “If someone swears a lot in their sentences, that is a sign of their poor vocabulary.” 1. They like using the "F" word to get attention.

Is it true that people in the US use the F Word?

Any , some, or all of these may be true. Some people, more it would seem in the USA (at least from cinema films) than in the UK, use the “f” word frequently - but even then, only in certain social contexts and certainly never “in almost all the sentences they say”.

Why are there bumps on the F and J Keys?

Why are there bumps on the F and J keyboard keys? The small bumps or ridges found on the F and J keyboard keys are to help users correctly position their left and right hands without having to look at the keyboard. For example, without looking at your hands, you can feel the small bumps to correctly position your left and right index fingers on ...

Why does my boyfriend use the F-Word all the time?

I believe this man’s constant use of the f-word was his way of dealing with the incredible pain he was in over his life choices. I should mention that along with anger, he was often overcome by sadness and despair. Before we split up we had a few conversations about this topic and he agreed to seek help for his anger.


Video Answer


1 Answers

The travis version is building with an FSharp.Core from the GAC:

-r:/usr/lib/mono/gac/FSharp.Core/4.3.1.0__b03f5f7f11d50a3a/FSharp.Core.dll

Whereas your local build is using the FSharp.Core at:

-r:"/Library/Frameworks/Mono.framework/Versions/4.0.2/lib/mono/xbuild/../Reference Assemblies/Microsoft/FSharp/.NETCore/3.259.3.1/FSharp.Core.dll"

The error you are getting:

FSC: error FS0193: The module/namespace 'System.Net' from compilation unit 'System' did not contain the namespace, module or type 'WebClient'

Indicated a mismatched FSharp.Core where its trying to resolve System.Net references from the Fsharp.Core located in the GAC, the other references in your project are all PCL 259 which will not satisfy this reference.

As to why, could you get travis to build using the diagnostic switch?

Ok so following on, now that there is a diagnostic build linked, the problem is here:

HintPath /usr/lib/mono/xbuild/../Reference Assemblies/Microsoft/FSharp/.NETCore/3.259.3.1/FSharp.Core.dll does not exist. Reference FSharp.Core resolved to /usr/lib/mono/gac/FSharp.Core/4.4.0.0__b03f5f7f11d50a3a/FSharp.Core.dll. CopyLocal = False Reference found at search path {GAC}

The travis instance does not have:

/usr/lib/mono/xbuild/../Reference Assemblies/Microsoft/FSharp/.NETCore/3.259.3.1/FSharp.Core.dll

So it reverts to the gac.

There was a recent issue where FSharp.Core was not installed to the correct location, maybe this is a manifestation of that.

What I would do is try a different version of mono as described here: http://docs.travis-ci.com/user/languages/csharp/ Maybe try an older one like 3.12 or alpha or beta to try and confirm that this is indeed the issue.

like image 181
7sharp9 Avatar answered Oct 15 '22 23:10

7sharp9