Unable to run dotnet under certain directories?


I am using the command: dotnet "myfile.dll"

Initially it was giving me this error: The user's home directory could not be determined. Set the 'DOTNET_CLI_HOME' environment variable to specify the directory to use.

Now after messing around with it, I have moved my files to c:/mydir, and it is giving this error: Failed to initialize CoreCLR, HRESULT: 0x80070057. I found this, but isn't c:/mydir a drive root?

Couple of things I noted:

  1. I am able to run the .dll fine in a different directory.

  2. Both directories contain same files.

The reason I want to run it in c:/mydir is because I am using AWS CodeDeploy, and that is where it copies the files (as far as I know; and the other directories are just the old versions where the files get copied from).

These issues are not linked (the first one I get from running a automated shell script after installation, and the second I get from manually trying to launch the .dll). If someone could help me solve either one of these issues it would be greatly appreciated.

asked on Stack Overflow Mar 14, 2019 by Bureto

1 Answer


Try adding Environment=DOTNET_CLI_HOME=/temp to your Service declaration in your .service file. Example syntax:


So the actual like would look like this

answered on Stack Overflow Jun 6, 2020 by R15

User contributions licensed under CC BY-SA 3.0