Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simple console app in .NET.Core - doesn't run
Message
From
14/05/2020 10:36:48
 
General information
Forum:
C#
Category:
Deployments
Miscellaneous
Thread ID:
01674247
Message ID:
01674419
Views:
51
This message has been marked as a message which has helped to the initial question of the thread.
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-found
which 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 :(
John Harold Belalcázar Lozano
Associate Director Of Development
http://www.belvicto.co/
jhbelalc@gmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform