Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotnet executable path in standalone mode #24

Closed
weliwita opened this issue Feb 20, 2018 · 9 comments
Closed

Dotnet executable path in standalone mode #24

weliwita opened this issue Feb 20, 2018 · 9 comments

Comments

@weliwita
Copy link

I can see following logic in the creclrembedding.cpp line 337.

if (mode == host_mode_t::standalone && dotnetExecutablePath.empty())
	{
		throwV8Exception("This is not a published, standalone application and we are unable to locate the .NET Core SDK.  Please make sure that it is installed; see http://microsoft.com/net/core for more details.");
	}

I don't understand why it looks for dotnet executable binary in the PATH if this is standalone mode. I think it should not be dependent on any external 'dotnet' binary but only the binaries in the EDGE_APP_ROOT. Can someone please explain the correct way to run in standalone mode?

@agracio
Copy link
Owner

agracio commented Feb 20, 2018

What problem you trying to solve? What kind of errors you getting when running your app and what settings you pass to it?
Edit: What OS and .NET runtime you using?

@weliwita
Copy link
Author

weliwita commented Feb 21, 2018

Hi agracio,

Thank you for all the effort you are putting to keep this project live. We really appreciate it.

This issue is electron specific, I have done few modifications to run this app on electron. I know there is a separate edge-js project for electron, but I think it only changes the way it is built(against node vs electron) So if we build correctly this project should also run on electron. As we don't have dotnet core on client machines where electron app is installed, we package the standalone app with electron
OS is windows(but reproducible on Mac). latest dotnet sdk version is 2.1.4
I have a repro app here .https://github.com/weliwita/edge-js-quick-start

  1. Creating the standalone core app.
cd src\QuickStart.Core
publish.bat

published app will be created in \src\QuickStart.Core\bin\Release\netcoreapp2.0\win-x64\publish

  1. Install dependencies
    npm install

fixing to build with electron

In node-modules\edge-js\package.json remove the install script

"scripts": {
    "test": "node tools/test.js"
  },

Build the dependencies with electron builder

node_modules\.bin\electron-builder install-app-deps
  1. Run the app
    npm run start

you will get the expected output as you have dotnet on your path

.NET Core welcomes Node.Js
  1. Now set the path just to include nodejs, removing dotnet from the path.

set PATH="C:\Program Files\nodejs"

it will throw following exception

App threw an error during load
Error: This is not a published, standalone application and we are unable to locate the .NET Core SDK.  Please make sure that it is installed; see http://microsoft.com/net/core for more details.
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\r\Repo\edge-js-quick-start\node_modules\edge-js\lib\edge.js:53:8)
    at Object.<anonymous> (D:\r\Repo\edge-js-quick-start\node_modules\edge-js\lib\edge.js:181:3)
Terminate batch job (Y/N)? Y
  1. If we comment out the exception throwing section and build the edge-js, app works as expected
    host_mode_t mode = coreclr_exists_in_dir(edgeAppDir) ? host_mode_t::standalone : host_mode_t::muxer;

	// if (mode == host_mode_t::standalone && dotnetExecutablePath.empty())
	// {
	// 	throwV8Exception("This is not a published, standalone application and we are unable to locate the .NET Core SDK.  Please make sure that it is installed; see http://microsoft.com/net/core for more details.");
	// }

	pal::string_t configFile, devConfigFile, sdkPath;

node_modules\.bin\electron-builder install-app-deps

This is also reproducible on mac-os following similar steps.

electron version is 1.8.2

@agracio
Copy link
Owner

agracio commented Feb 21, 2018

I think the problem is with if statement itself, currently is throws exception when app is standalone and there is no .NET SDK., instead it should should throw exception when app is not standalone and there is no .NET SDK

if (mode == host_mode_t:: muxer && dotnetExecutablePath.empty())
{
    throwV8Exception("This is not a published, standalone application and we are unable to locate the .NET Core SDK.  Please make sure that it is installed; see http://microsoft.com/net/core for more details.");
}

@weliwita
Copy link
Author

Yes, That makes sense. Thanks.

@agracio
Copy link
Owner

agracio commented Feb 21, 2018

Will be done in a couple of days, it will also be merged to electron-edge-js so you dont need to recompile the project

@weliwita
Copy link
Author

Thanks, Will it be not required to compile for Mac and Linux? Last time I checked It was just windows binaries are included and had to compile for Mac and Linux.

@agracio
Copy link
Owner

agracio commented Feb 21, 2018

Mac and Linux compile on npm install

agracio pushed a commit to agracio/electron-edge-js that referenced this issue Feb 22, 2018
@agracio
Copy link
Owner

agracio commented Feb 22, 2018

Just published new versions of edge-js and electron-edge-js with fix, let me know if you still have problems.

@weliwita
Copy link
Author

weliwita commented Feb 23, 2018

Ok, it solved the issue. Thank You

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants