Hi, Naomi, try to publish your project using the respective option, just taking the obj or exe file created by compiling won't work.
The publish option will ask you for some settings includying "Deployment mode" there you pick "Self-contained" this will generate a real standalone executable.
>>>>>>
Hi everybody,
I created a very simple .NET core console application. Just selected all defaults and created a very simple program to output details about files and number of lines in them.
I then just build the application directly in VS 2019. I see exe created in the debug folder.
However, when I try to run it I get this error
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet'.
What should I do to create such a simple exe and being able to run it on my local computer and just copy the exe to run on others?
Thanks in advance.
UPDATE. When I searched for this error I found
https://stackoverflow.com/questions/38085430/the-library-hostpolicy-dll-was-not-foundwhich said to use obj folder instead of the bin.
I think I just now tried
bin\Debug\netcoreapp3.1 folder and the exe in it works for me now on my local laptop.
---------------------------
Unfortunately, it still doesn't work on other computer and the solution specified there is too complex for me :(