question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

F# Compilation Failure: Multiple references to 'mscorlib.dll' are not permitted

See original GitHub issue

I’m running into a scenario where adding a few NuGet packages to my F# function results in the following error being spit out multiple times during compilation:

2016-12-04T21:05:16.249 commandLineArgs(1,1): error FS215: Multiple references to 'mscorlib.dll' are not permitted

Here’s a project.json that reproduces the issue:

{
    "frameworks": {
        "net46": {
            "dependencies": {
                "FSharp.Data": "2.3.2",
                "FSharp.Data.SqlClient": "1.8.2",
                "Microsoft.Azure.Search": "3.0.1"
            }
        }
    }
}

It’s also worth noting that this happens regardless of what’s in the function itself, so is caused simply by adding the references.

Repro steps

  1. Create a new F# function

  2. Add the project.json file above

  3. 💥

Expected behavior

The function should compile

Actual behavior

The function fails to compile

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
fabiocavcommented, Dec 6, 2016

Agreed. The fix will primarily target the .NET package assembly resolver and metadata resolver, but I’ll also make some enhancements to the F# compilation service, including the logging enhancements mentioned above. My goal is to have this (and #890) addressed on the next update, which should happen before the end of the month.

1reaction
fabiocavcommented, Dec 5, 2016

@gshackles will have a fix for this ASAP and see if we can squeeze it in with the next release (which also brings some other F# fixes)

@stefan-akelius the process is a bit less “magical” than what described in the post 😃 For NuGet referenced packages, the behavior you get is similar to what you’d get with .NET Core or Visual Studio, where the appropriate package assemblies are referenced, so there’s no special way to reference those assemblies with a #r (or need to do so). I don’t want to hijack the issue, but I would like to hear more about what you dislike with the current process, as we’re always looking to improve (including exposing the right hooks to enable other flows and better integration with other tools like Packet, which is something that has been discussed) if you could either open an issue with more details or contact me directly at fabio.cavalcante@microsoft.com, that would be great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot add mscorlib.dll to Visual Studio project
A reference to 'mscorlib' could not be added. This component is automatically referenced by the project system and cannot be referenced directly ...
Read more >
Problems compiling DLLs from MonoDevelop
I have duplicated exactly all the settings in Unity's own Assembly-UnityScript.unityproj and included the exact same references, but when I ...
Read more >
Compiler Error CS0731
This error can only occur with improperly formed imported metadata. It cannot occur with only C# source. Example. The following sample generates ...
Read more >
C++ project no longer builds in VS2022: could not find ...
Under Project Properties/Advanced/C++/CLI Properties one can find new option: Enable CLR Support for Inividual Files. This item is visible only, ...
Read more >
Learn about how to add mscorlib dll reference
Read about how to add mscorlib dll reference, The latest news, videos, and discussion topics about how to add mscorlib dll reference from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found