无法与DNX 4.5.1一起使用System.Net.Utilities [英] Unable to use System.Net.Utilities with DNX 4.5.1

查看:101
本文介绍了无法与DNX 4.5.1一起使用System.Net.Utilities的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先发布并完成C#,DNX,ASP.net新手,所以请保持友善.

first post and complete C#, DNX, ASP.net noob so please be nice.

我在使用DNX 4.5.1构建ASP.net 5.0项目时遇到了麻烦.我的project.json文件包含以下内容:

I'm having trouble building my ASP.net 5.0 project using DNX 4.5.1. My project.json file contains the following:

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

  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "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.FileProviderExtensions" : "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "System.Net.NetworkInformation": "4.1.0-beta-23516",
    "System.Net.Utilities": "4.0.0-beta-23516"
  },

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

  "frameworks": {
    "dnx451": {},
    "dnxcore50": {}
  },

  "exclude": [
    "wwwroot",
    "node_modules",
    "bower_components"
  ],
  "publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [
      "npm install",
      "bower install",
      "gulp clean",
      "gulp min"
    ]
  }
}

然后,"dnu restore"将按需安装所有内容.但是,当我运行"dnu build"时,出现以下两个错误:

And "dnu restore" installs everything as it should. However when I run "dnu build", I get these two errors:

error NU1002: The dependency System.Net.Utilities 4.0.0-beta-23516 in project PingTest1 does not support framework DNX,Version=v4.5.1.

DNXCore,Version=v5.0 error CS1061: 'Ping' does not contain a definition for 'Send' and no extension method 'Send' accepting a first argument of type 'Ping' could be found (are you missing a using directive or an assembly reference?)

作为一个完整的菜鸟,我不知道如何更正此问题,并且使用谷歌搜索找不到任何答案.任何帮助将不胜感激.

Being a complete noob, I have no idea how to correct this and googling doesn't find any answers. Any help would be greatly appreciated.

可以在这里找到我完整的源代码: https://github.com/00101010b/PingTest1

My complete source code can be found here: https://github.com/00101010b/PingTest1

推荐答案

解决方案是从project.json文件中删除以下行:

The solution was to remove the following line from project.json file:

"dnx451": {},

并依次从Terminal.app运行以下命令:

And run the following commands in order from Terminal.app:

dnvm upgrade -r coreclr
dnu restore
dnu build

最后,我替换了一些代码以使用Ping().SendPingAsync().

And finally I replaced some of my code to use Ping().SendPingAsync().

这解决了构建问题.但是,我仍然无法ping通IP地址...我将在不久后发布一个有关它的新线程.

This fixed the build issue. However, I still have issues with pinging IP addresses... I will post a new thread about it shortly.

非常感谢.

这篇关于无法与DNX 4.5.1一起使用System.Net.Utilities的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆