2
votes

I am creating a POC to see how hard it would be to create our c# library projects, using the new DNX build approach. I installed VS 2015 and am running on: dnu --version 1.0.0-beta4-11566. My c# libraries still need to support .net 4.0, however I want to take advantage of the new build/nuget stuff that is coming out with project.json + nuget 3.0. So I created one library app and tried to consume it, in a console app.

1) ClassLibrary1
2) ConsoleApp1

ClassLibrary1 project.json

{
  "version": "1.0.0-*",
  "description": "poc",
  "authors": [ "Patrick" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "Newtonsoft.Json": "6.0.8",
    "Microsoft.Bcl": "1.1.10"
  },

  "frameworks": {
    "net40": { }
  }
  }

ConsoleApp1 project.json

{
  "version": "1.0.0-*",
  "description": "Another test",
  "authors": [ "Patrick" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "ClassLibrary1": "1.0.0"
  },

  "commands": {
    "MyProj": "MyProj"
  },

  "frameworks": {
    "net40": {},
    "dnx451": {}
  }
}

I thought I could remove framework dnx451, however my console app will not run without dnx451 (dnx . run). However it will build using dnu build!!! Why? This is the error I get when I leave dnx451 out and try to run it.

System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'DNX,Version=v4.5.1': Microsoft.Bcl 1.1.10 Newtonsoft.Json 6.0.8

1

1 Answers

0
votes

DNX projects can reference .NET 4 apps, but I do not believe that the DNX runtime can run a DNX based project that only references a net40 project. dnx451 being the name for the execution environment running on .NET 4.5.1, without that the console app has no idea how to load.