How to add .net 4.5 library reference in .Net Core?

How can I add Microsoft.TeamFoundation.Client library in my ASP 5 application? The library is supported only by dnx 4.5.1 and not dnx 5.0.

When I try to build my application I get the following error -

CS0234 The type or namespace name 'TeamFoundation' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?

When I delve further by hovering over the using TeamFoundation statement, I get the following message:

{} Namespace Microsoft.TeamFoundation
  MyProject.DNX 4.5.1 - Available
  MyProject.DNX Core 5.0 - Not Available
You can use the navigation bar to switch context.

How can I switch context using the navigation bar?

How can I target dot net version 4.5.1 using my ASP 5 application?

Thanks! First time asking!

My Project.JSON File -

{
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration": "1.0.0-rc1-final",
    "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"
  },

  "frameworks": {
    "dnx451": {
      "dependencies": {
        "Microsoft.TeamFoundationServer.ExtendedClient": "14.89.0",
        "Microsoft.WindowsAzure.ConfigurationManager": "3.2.1"
      },
      "frameworkAssemblies": {
        "System.Activities": "4.0.0.0"
      }
    },
    "dnxcore50": { }
  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ]
}

Answers


You are depending on an assembly that does not have support for dnxcore50. If you don't care about supporting .NET Core and are happy to continue using the Desktop framework, then you can remove "dnxcore50": { } from your list of frameworks in project.json.


Yeah, I just checked it out for you and Microsoft.TeamFoundationServer.ExtendedClient does not support DNX Core framework yet.

So as vcsjones pointed out you can remove the dnxcore50 part, if you don't need to be cross-platform.

Once you've removed dnxcore50, move Microsoft.WindowsAzure.ConfigurationManager up to your regular dependencies. And save your project.json file to create a new lock file.

If that didn't work then go to your folder that contains the .sln file and run "dnu restore" in the command prompt.

This should work.


Need Your Help

BeautifulSoup get innerhtml data

javascript python urllib2 beautifulsoup innerhtml

I am trying to read data from a website. I can see the value I need but the value does not appear in the downloaded html code (using urllib2). The value is created by some js file and embedded into...