Reputation: 17
I made a ASP.NET Core webapp and wish to deploy it to my raspberry pi and host it using NGINX. Am following the guide provided by Microsoft: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2
and i am stuck at testing the app. This is what I did:
On my Windows PC in which I developed the webapp on, i went to the solution path:
E:\testapp
and ran the command on cmd:
dotnet publish --configuration Release
No errors was found and it was shown that my project L07 that was part of the testapp solution was successful.
But when i tried to test the app by running:
dotnet L07.Views.dll
it returned a fatal error:
A fatal error was encountered. The library 'hostpolicy.dll' required
to execute the application was not found in 'E:\testapp\L07\bin\Release\net461\publish\'.
Failed to run as a self-contained app. If this should be a framework-dependent app,
add the E:\testapp\L07\bin\Release\net461\publish\L07.Views.runtimeconfig.json
file specifying the appropriate framework.
. I ignored that and transferred the entire E:\testapp\L07\bin\Release\net461\publish files to my raspberry pi and ran the same dotnet command and it gave me another fatal error which is:
A fatal error occurred, the folder [/usr/local/bin/host/fxr] does not exist
I feel that I am doing many wrong things here, anyone able to advise accordingly, as detailed as possible.
p/s not sure im i am posting this in the correct site
Upvotes: 1
Views: 1034
Reputation: 30625
You need to open your .csproj and add proper runtime identifiers for release. Alternatively you can enter correct runtime identifier from command prompt
This link includes catalog of runtime identifiers
dotnet publish -runtime <yourRID> ...
As it is commented by @Tseng, you need to decide whether you need self-contained or frame dependent application.
If you want to publish self-contained applciation then
dotnet publish -runtime <yourRID> --self-contained ...
Upvotes: 2