kspearrin
kspearrin

Reputation: 10738

DNX 4.5.1 cannot resolve System libraries after beta6 upgrade

After upgrading my solution from beta5 -> beta6, my projects can no longer resolve System. and a host of other core libraries.

For example, I get things like

Predefined type 'System.Object' is not defined or imported

and

Predefined type 'System.Boolean' is not defined or imported

Screenshot of errors

I have downloaded the latest beta6 runtimes via dnvm:

C:\Users\me>dnvm list

Active Version     Runtime Architecture Location                  Alias
------ -------     ------- ------------ --------                  -----
       1.0.0-beta4 clr     x64          C:\Users\me\.dnx\runtimes
       1.0.0-beta4 clr     x86          C:\Users\me\.dnx\runtimes
       1.0.0-beta4 coreclr x64          C:\Users\me\.dnx\runtimes
       1.0.0-beta4 coreclr x86          C:\Users\me\.dnx\runtimes
       1.0.0-beta5 clr     x64          C:\Users\me\.dnx\runtimes
       1.0.0-beta5 clr     x86          C:\Users\me\.dnx\runtimes
       1.0.0-beta5 coreclr x64          C:\Users\me\.dnx\runtimes
       1.0.0-beta5 coreclr x86          C:\Users\me\.dnx\runtimes
       1.0.0-beta6 clr     x64          C:\Users\me\.dnx\runtimes
  *    1.0.0-beta6 clr     x86          C:\Users\me\.dnx\runtimes default
       1.0.0-beta6 coreclr x64          C:\Users\me\.dnx\runtimes
       1.0.0-beta6 coreclr x86          C:\Users\me\.dnx\runtimes core

I have updated my solutions global.json:

{
    "projects": [ "src", "test" ],
    "sdk": {
        "version": "1.0.0-beta6"
    }
}

I have updated all my referenced packages in project.json:

{
    "version": "0.0.1-*",
    "description": "",
    "authors": [ "" ],
    "tags": [ "" ],
    "projectUrl": "",
    "licenseUrl": "",

    "dependencies": {
        "System.ComponentModel.Annotations": "4.0.10-beta-23109",
        "Newtonsoft.Json": "6.0.6"
    },

    "frameworks": {
        "dnx451": { },
        "dnxcore50": {
            "dependencies": {
                "System.Collections": "4.0.10-beta-23109",
                "System.Linq": "4.0.0-beta-23109",
                "System.Threading": "4.0.10-beta-23109",
                "Microsoft.CSharp": "4.0.0-beta-23109",
                "System.Net.Http": "4.0.0-beta-23109",
                "System.Security.Cryptography.RandomNumberGenerator": "4.0.0-beta-23109",
                "System.Runtime.Extensions": "4.0.10-beta-23109"
            }
        }
    }
}

I feel like this same thing happened to me when I went from beta4 -> beta5 but I cannot recall what I did to fix it.

This only happens for the CLR runtime. CoreCLR resolves these libraries just fine when I switch to it.

Cleaning the solution does not help.

How do I fix this?

Upvotes: 2

Views: 1400

Answers (1)

Joe Audette
Joe Audette

Reputation: 36706

you need to move this:

"System.ComponentModel.Annotations": "4.0.10-beta-23109"

out of the main dependencies section into the one below dnxcore50

then you may also need to update dnx451 with needed frameworkAssemblies:

"dnx451": {
      "frameworkAssemblies": {
        "System.ComponentModel": ""
      }

Upvotes: 2

Related Questions