The project being published does not support the framework "dnx-clr-win-x86-beta6"?

NOTE: I have seen this error in other posts, but the problem is that the main solution I've seen, to explicitly define the framework instead of using the default, doesn't work.

My project has 1.0.0-beta6 defined as the version in global.json, and as far as I can tell it's not using anything that doesn't support beta6. I've tried compiling the project with the frameworks "dnxcore50" and "dotnet" and neither works (my preference is dotnet for compatibility but I'd use either).

Here's my project.json:

   {
  "version": "1.0.0-*",
  "description": "Cormaran Class Library",
  "authors": [ "Me" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "Microsoft.CSharp": "4.0.0-beta-23019",
    "System.Net.Sockets": "4.0.10-beta-23123",
    "System.Text.Encoding": "4.0.10-beta-23019",
    "Newtonsoft.Json": "7.0.1",
    "System.Collections": "4.0.11-beta-23225"
  },

  "frameworks": {
    "dnxcore50": {

    }
  }
}

And here's my global.json:

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-beta6",
    "runtime": "clr",
    "architecture": "x86"
  }
}

Now, this may not be static (but it might be helpful) so I'm putting the project's github here for reference (if you make any statements based on it, I'll add the code here in case anybody else has this problem).

https://github.com/ThePlatinumTaco/Cormaran/tree/master/src/

Upvotes: 1

Views: 361

Answers (1)

Joe Audette
Joe Audette

Reputation: 36736

there are multiple things that can cause these kinds of issues. It took me a while to figure out that VS/Nuget sometimes puts dependencies in the main dependencies section that really should be in the dnxcore50 specific dependencies. People find the easy way to solve those errors by removing dnx451 from project.json like you have done but you don't need to do that. you just need to move the dependencies like this:

{
  "version": "1.0.0-*",
  "description": "Cormaran Class Library",
  "authors": [ "Me" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "Newtonsoft.Json": "7.0.1"
  },

  "frameworks": {
    "dnx451" : {
        "frameworkAssemblies": {
            "System.Xml": ""
         }
    },
   "dnxcore50": {
        "dependencies": {
            "Microsoft.CSharp": "4.0.0-beta-23019",
            "System.Net.Sockets": "4.0.10-beta-23019",
            "System.Text.Encoding": "4.0.10-beta-23019",
            "System.Collections": "4.0.10-beta-23019",
            "System.Xml.XDocument": "4.0.10-beta-23019"
        }

    }
  }
}

in "some" cases you may need to add frameworkAssemblies under dnx451 that sort of correspond to some of the dependencies under dnxcore50 for example as shown with System.Xml which is needed if you also need System.Xml.XDocument in dnxcore50. I added that to give you an example, you probably don't need that in your project unless you are using xml classes.

The other problem in what you posted is mismatched versions, note how I have corrected the versions for the dependencies you posted to keep them at the same beta6 level whereas some of the ones you posted were newer beta7 ones with -23225. It is confusing since those don't indicate which beta they go with but there is a correspondence.

The other things to check are the web.config file in your wwwroot folder which also may have settings about which runtime to use, and right click the prject and go to properties to see if the project is configured for a specific runtime. all these things must be in sync.

also in your global.json you are specifying "clr" which really corresponds to dnx451 whereas dnxcore50 corresponds to "coreclr"

Upvotes: 1

Related Questions