Sitecore / Sitecore.Pathfinder

Get started, get far, get happy!
Other
34 stars 12 forks source link

Build 0.9.441. hostpolicy.dll fatal error. #61

Closed MGlauser closed 7 years ago

MGlauser commented 7 years ago

1st time I've installed Sitecore.Pathfinder and .Net Core. (today)

scc g y HelloWorld gives error:

dotnet "C:\Program Files (x86)\Sitecore.Pathfinder\Sitecore.Pathfinder.Console.dll" g y HelloWorld A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files (x86)\Sitecore.Pathfinder'.

JakobChristensen commented 7 years ago

Hmm... I cannot reproduce this.

As far as I can tell, hostpolicy.dll is part of .NET Core. There are no references to it in the Pathfinder source code.

Did you install .NET Core 1.1?

jimcftr commented 7 years ago

I have the same problem as MGlauser, and also with a fresh install of .NET Core (never used it before).

It's confusing whether the versions are correct:

"dotnet" by itself says .NET Core Shared Framework Host, Version: 1.1.0, build: 928f77c4bc3f49d892459992fb6e1d5542cb5e86

"dotnet --info" shows ".NET Command Line Tools (1.0.4)", Version: 1.0.4, Commit SHA-1 hash: af1e6684fd"

I couldn't figure out how to install a .NET Core SDK for 1.1, it only wants 1.0.4, but it did install the runtime for 1.1.

Might be worth noting that this is a work computer and I'm stuck on Windows 7?

JakobChristensen commented 7 years ago

I think maybe hostpolicy.dll is part of the .NET Core SDK. When I search my machine for it, I find it in the these locations:

c:\program files\dotnet\sdk\x.x.x\hostpolicy.dll c:\program files\dotnet\shared\Microsoft.NETCore.App\x.x.x\hostpolicy.dll

I can see that "c:\program files\dotnet" is part of my environment Path variable.

Could you check if you can find the file as well?

jimcftr commented 7 years ago

Interesting -- the hostpolicy.dll is in those same locations, and I have "c:\program files\dotnet" in my PATH also.

I copied hostpolicy.dll directly into the c:\program files (x86)\sitecorepathfinder dir, and then it gives a different error: "Could not resolve CoreCLR path."

setting COREHOST_TRACE to get a bunch of debug output, gave this output (attached):

trace.txt

still scratching my head, it seems like something really basic which must be missing, but this is the first time I've tried running a .NET Core app and have no idea where to look. Thanks for the help thus far.

JakobChristensen commented 7 years ago

I tried publishing Pathfinder which build a distributable folder with all dependencies. This includes hostpolicy.dll.

Unfortunately the size of the folder is 54Mb which is a bit excessive.

I think the correct approach is a distributable folder (or something like it), but I don't know how and where to host it yet.

jimcftr commented 7 years ago

Maybe I should ask the question from the other side -- I was able to get it to compile locally, and if I can navigate to the ...\src\Sitecore.Pathfinder.Console dir, I can type "dotnet run" and it appears to successfully run what you describe as just running "scc". There's also an scc.cmd file in that dir, but if I run it, it says "the application to execute does not exist: ........\Sitecore.Pathfinder.Console.dll".

How do you (since you probably compile this from source) actually use this for going into other dirs on the filesystem and running "scc", i.e. how do you get from "dotnet run" into flexible "scc"?

54mb for a distribution folder sounds excessive to me too, but then considering the size of usual Windows software distributions, it almost seems small. If that's what's necessary to get this to distribute cleanly, I think for the time being it's better than nothing at all.

Ultimately I'm just still trying to actually use this, so I'll do whatever is necessary, once we figure it out. Thanks for your help!

adeneys commented 7 years ago

I think the distribution requires the full publish.

Using COREHOST_TRACE I could see dotnet trying to find the runtime config file for the app. Once I added that file (from another blank net core app) The issue about hostpolicy.dll goes away, and I got an error about not finding Newtonsoft.Json.dll.

As a trial, I used Publish in Visual Studio (as you did above @JakobChristensen ) and then copied all the additional files over to my install location, and the app worked.

JakobChristensen commented 7 years ago

You can now install Pathfinder using npm.

npm install -g sitecore-pathfinder