sdk: Minimal console app unhandled FileNotFoundException

I installed the mac osx pkg installer from get.asp.net. I then created a very minimal hello world console app. I’ve ran dotnet restore which appears to have run successfully. Then when I run dotnet run I get this:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 47 (18 by maintainers)

Commits related to this issue

Most upvoted comments

Hey, seems like this bug is back:

$ dotnet new
Created new project in  /Users/sharmaloic/Code/REPL
$ dotnet restore
Microsoft .NET Development Utility CoreClr-x64-1.0.0-rc1-16231

  CACHE https://api.nuget.org/v3/index.json
Restoring packages for /Users/sharmaloic/Code/REPL/project.json
  GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.runtime/index.json
  GET https://api.nuget.org/v3-flatcontainer/system.io/index.json
  GET https://api.nuget.org/v3-flatcontainer/system.console/index.json
  GET https://api.nuget.org/v3-flatcontainer/system.runtime/index.json
  OK https://api.nuget.org/v3-flatcontainer/system.io/index.json 300ms
  OK https://api.nuget.org/v3-flatcontainer/microsoft.netcore.runtime/index.json 525ms
  OK https://api.nuget.org/v3-flatcontainer/system.console/index.json 387ms
  OK https://api.nuget.org/v3-flatcontainer/system.runtime/index.json 433ms
Writing lock file /Users/sharmaloic/Code/REPL/project.lock.json
Restore complete, 7195ms elapsed

NuGet Config files used:
    /Users/sharmaloic/.config/NuGet/nuget.config

Feeds used:
    https://api.nuget.org/v3-flatcontainer/
$ dotnet run

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Console, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
$ dotnet build

Unhandled Exception: System.ComponentModel.Win32Exception: No such file or directory
   at System.Diagnostics.Process.ResolvePath(String filename)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at Microsoft.DotNet.Cli.Utils.Command.Execute()
   at Microsoft.DotNet.Cli.Program.Main(String[] args)
Abort trap: 6
$ dotnet restore --runtime osx.10.10-x64
   ....
$ dotnet run
Hello World!

I’m on El Capitan 10.11 and freshly installed the .NET Core SDK Installer linked in the readme.