1

Im using Clean RC2 Template for web application.

after adding Reference to System.linq it gives me this :

enter image description here

Im using 461 as framework.

svick
  • 236,525
  • 50
  • 385
  • 514
Ahad Porkar
  • 1,666
  • 2
  • 33
  • 68
  • Did you restore packages after modifying your project.json? – svick Jun 24 '16 at 12:06
  • @svick yes ive done that. if i remove those like projects workds well.I guess JC1001 answer is corret. so when i set 461 , i dont need to add reference inside package.json , since its using desktop dotnet framework. – Ahad Porkar Jun 25 '16 at 05:16

2 Answers2

2

It's automatically restore back the package version to match the targeted framework version (net461). So actually it's "detecting" nuget packages. You trying to target 461 in the image, so the packages rolling back from .net core preview1 to .net framework 4.6.1 . If you want target multiple framework (or as I see you want RC2 packages, meaning want .net core), your config.json file's frameworks section should look like this for example:

"frameworks": {
  "net461": { // old .net framework
      "dependencies":{
        "System.LINQ": "4.0.0.0"
      }
   },
   "netstandard1.5":{ // .net core
       "dependencies":{
        "System.LINQ": "4.1.0-RC2-*"
      }
   }
},

Here is a good info about targeting platforms

If you just want use .net core, remove the net461.

I see you want ASP.net core. Here is some cli ASP MVC samples. Here is a really nice ASP.net core sample project (using latest .net core, you have to update to RTM/preview2)

Eric Liu
  • 585
  • 1
  • 7
  • 11
1

You should already be able to use LINQ in your code (using System.Linq) without having to add a reference.

Since you are targeting .NET 461, you can add any additional GAC references in the frameworkAssemblies section in your project.json, e.g.

"frameworks": {
    "net461": {
        "frameworkAssemblies": {
            "System.ServiceProcess": "4.0.0.0",
            "System.Configuration": "4.0.0.0"
        }
    }
},

See this question for an explanation between dependencies and frameworkassemblies.

Community
  • 1
  • 1
JC1001
  • 516
  • 3
  • 10