Following is my server environment
- Server : VPS
- Host : AWS EC2
- OS : CentOS Linux 8.3.2011
- Plesk : Plesk Obsidian 18.0.34
- .Net Version : .Net Core 3.1.11 (Installed manually from linux CLI)
What I am look for
I have created a .Net core test application and tried to run the app using following and everything works fine. App runs fine with “Hello World!”, All Good.
dotnet new console dotnet run
But when I tried to publish and run the app,
dotnet publish -c Release dotnet -d contest.dll
It gives following error, I have made sure path and file names all are proper.
Telemetry is: Disabled projectfactory: MSBUILD_EXE_PATH = /usr/lib64/dotnet/sdk/3.1.111/MSBuild.dll projectfactory: MSBuild project path = projecttoolscommandresolver: ProjectFactory did not find Project. Microsoft.DotNet.Cli.Utils.CommandUnknownException: Could not execute because the specified command or file was not found. Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET Core program, but dotnet-contest.dll does not exist. * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH. at Microsoft.DotNet.CommandFactory.CommandFactoryUsingResolver.Create(ICommandResolverPolicy commandResolverPolicy, String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath, String applicationName) at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient) at Microsoft.DotNet.Cli.Program.Main(String[] args)
I have tried API, Console and other templates. Error remains same for all.
Any help would be highly appreciated.
Many Thanks & Regards
Advertisement
Answer
Try dotnet contest.dll
first. Please note the absence of option -d
in the command.
Even then it does not run most likely it is a permission issue. Does the user have executable permissions?
You can try giving permissions using chmod ### directory/where/dotnet/publish
is done. Try giving 777 permissions and check.
You can also try clearing Nuget cache files at /tmp/NuGetScratch/lock/
using command rm /tmp/NuGetScratch/lock/*
if the some other user has used chmod
command. Sometimes nuget lock files do create issues if multiple users have access to lock
directory.