1

I'm using the Nuget package System.Net.Sockets in a project and I'm trying compile it, but when I do I receive a System.IO.FileNotFoundException.

It's referenced in a Web Console Project using frameworks dnx451 and dnxcore50 (but it's only referenced in the core50 project.json, 451 doesn't need it). I can use it in the project with no errors, but once it won't actually run anything because it gets an error as soon as it starts. I checked my .dnx file, and the package (and all of its dependencies) are installed. I've tried clearing and reinstalling my packages, but nothing works.

Another weird error I'm having is when I'm using any of the actual classes from System.Net.Sockets, I get an error about the class being defined in System as well as System.Net.Sockets, and it shows that there's one version of the class available for Framework 4.5.1, and one available for Core 5.

Overall, I think the problem has to do with the Package being available for Framework 4.5.1 under the System namespace and under the System.Net.Sockets namespace for Core 5.0... I'm not sure why that would result in a System.IO.FileNotFound exception, so if anybody has ideas post them below.

My Project.json:

"frameworks": {
   "dnx451": { },
   "dnxcore50": {
      "dependencies": {
        "System.Collections": "4.0.10-beta-23019",
        "System.Console": "4.0.0-beta-23019",
        "System.Linq": "4.0.0-beta-23019",
        "System.Threading": "4.0.10-beta-23019",
        "Microsoft.CSharp": "4.0.0-beta-23019",
        "System.Net.Sockets": "4.1.0-beta-23225"
      }
   }
}

My Program.cs:

public class Program
{
    public void Main(string[] args)
    {
        BasicClient client1 = new BasicClient("127.0.0.1", 6379);
        client1.SetString("foo", "bar");
        Console.WriteLine(client1.GetString("foo"));
        Console.ReadLine();
    }
}

If you need anything else, feel free to poke around the repo.

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291
  • I've edited the relevant code into your question. Please don't post links to your code, as those will change or get deleted and will render this question useless in the future. – Dave Zych Sep 11 '15 at 15:08
  • 1
    Don't mix beta versions. – Hans Passant Sep 11 '15 at 15:19
  • I'm assuming this is because you added the dependency only to `dnxcore50` but are targeting both `dnxcore50` and `dnx451`. – Dave Zych Sep 11 '15 at 15:30
  • Adding or removing the dependency to the dnx451 framework changes nothing...? – TheNationalSarcasmSociety Sep 11 '15 at 15:39
  • You might want to try renaming `dnxcore50` to `dotnet` and dropping the `dnx451` under frameworks. Doing that cleaned up my project to the point that VSCode started working properly again. See this post for more info. http://stackoverflow.com/questions/31539341/project-json-definition-dnx451-vs-dotnet-4-51 – JMcDaniel Sep 12 '15 at 20:08
  • But then how would I be able to use the project in other projects, that may not be dotnet. – TheNationalSarcasmSociety Sep 15 '15 at 16:09

0 Answers0