I am creating a little program to ping a computer within a network. For this i am trying to use the class ping, from
namespace System.Net.NetworkInformation.Ping
I am using ASP.NET 5.0 so i hava project.json file with my dependecies
{
"version": "1.0.0-*",
"dependencies": {
"NetworkSniffer": "1.0.0-*",
"Microsoft.AspNet.Mvc": "6.0.0.0-beta2"
},
"commands": {
"run": "run"
},
"frameworks": {
"aspnet50": {
"dependencies": {
"System.Console": "4.0.0-beta-22231",
"System.Net.NetworkInformation": "4.0.10-beta-22231"
}
},
"aspnetcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-22231",
"System.Net.NetworkInformation": "4.0.10-beta-22231"
}
}
}
}
A simplefied version of the console code witch still gives the error is:
using System.Net.NetworkInformation;
namespace TestApp
{
public class Program
{
public static void Main(string[] args)
{
Ping p = new Ping();
}
}
}
the complete error when trying to compile this code is:
Code:Error CS0246 Description:The type or namespace name 'Ping' could not be found (are you missing a using directive or an assembly reference?) Project:TestApp.ASP.NET Core 5.0 file:Program.cs line:9