Could not load file or assembly 'dotnet.EXE.dll'
I downloaded net cli binaries and executed dotnet restore within folder which contains asp.net core project. Some packages were restored and several errors about incompativlity were displayed.
Then I tried execute dotnet new within empty directory and got error
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'dotnet.EXE.dll' or one of its dependencies.
I tried to uninstall and reinstall (and also repair) but error still occurs.
version 1.0.0.001540
@AlexeyRokhin which OS? Can you share your project.json?
@blackdwarf Windows 8.1 Professional x64. Sorry, it was console (not asp.net) project with following json:
{
"version": "1.0.0-*",
"description": "CoreConsoleApp1 Console Application",
"authors": [ "a.rokhin" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
},
"commands": {
"CoreConsoleApp1": "CoreConsoleApp1"
},
"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-23516",
"EntityFramework.SqlServer": "7.0.0-beta8"
}
}
}
}
But now I got error when I execute any dotnet xxx command within both console project directory and empty directory.
@AlexeyRokhin does running simply dotnet do anything on the system or does it not work?
@blackdwarf
dotnet without parameters causes the same exception.
@AlexeyRokhin can you try to upgrade to latest bits and see if it repros? It is a strange thing...
@blackdwarf
Same exception. Here the xml from event viewer:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> <System> <Provider Name="Application Error" /> <EventID Qualifiers="0">1000</EventID> <Level>2</Level> <Task>100</Task> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2016-02-29T14:38:51.000000000Z" /> <EventRecordID>544714</EventRecordID> <Channel>Application</Channel> <Computer>skipped</Computer> <Security /> </System> <EventData> <Data>dotnet.EXE</Data> <Data>0.0.0.0</Data> <Data>56d364f0</Data> <Data>KERNELBASE.dll</Data> <Data>6.3.9600.18202</Data> <Data>569e7eb1</Data> <Data>e0434352</Data> <Data>0000000000008a5c</Data> <Data>2750</Data> <Data>01d172fee886b0da</Data> <Data>C:\Program Files\dotnet\bin\dotnet.EXE</Data> <Data>C:\Windows\system32\KERNELBASE.dll</Data> <Data>263756c5-def2-11e5-82a5-d850e64e09a1</Data> <Data /> <Data /> </EventData> </Event>
Here call stack from attached debugger (VS 2015)
coreclr.dll!00007ffe31eb679c()
coreclr.dll!00007ffe31eba98e()
coreclr.dll!00007ffe31e73397()
coreclr.dll!00007ffe31e72bbb()
hostpolicy.dll!00007ffe524f66c4()
hostpolicy.dll!00007ffe524f6997()
dotnet.exe!00007ff7c93718a1()
dotnet.exe!00007ff7c939b718()```
@blackdwarf , I found workaround for issue:
call dotnet.exe instead of dotnet
Very strange.
strange indeed.
Can you where dotnet and where dotnet.exe and see if this yields anything interesting? I wonder if there's something funny on the PATH.
btw, in PowerShell you need to call where.exe
@piotrpMSFT
where dotnet and where dotnet.exe returns the same path.
Thank you for your note about powershell! Usually I'm using Far Manager instead of cmd.exe. I found that only Far Manager causes this exception. cmd.exe and powershell is OK.
ok, I think I get it. If you could, do one more experiment in Far Manager @AlexeyRokhin: call dotnet.EXE [note capitalization on .EXE]. Does it fail in the same way as dotnet[without .exe]?
dotnet.EXE fails exactly the same way as dotnet.
@schellap, I believe this to be a bug in CoreHost. Specifically, I expect that when Far Manager tries to resolve a file without extension then it grabs potential file extensions from PATHEXT and appends them to the provided file name. PATHEXT lists file extensions in upper case so it ends up looking for dotnet.EXE. This invokes dotnet.exe as dotnet.EXE, which is the string passed in to CoreHost. Now the bug: on Windows, once CoreHost determines that it's in CoreConsole mode it tries to determine its own name. If it's name ends in .exe then it trims the last four characters, appends .dll, and looks for an implementation dll with the same name. Otherwise, it appends .dll to the full string and looks for an implementation with that name. The problem is:
if (ends_with(result, _X(".exe")))
This is a case-sensitive comparison. So when Far Manager [or any other tool building a valid name for the exe] capitalizes the suffix, the comparison fails and we end up in the scenario outlined in this bug.
Moving the bug to RTM milestone.