Linux 中的 .Net Core 应用程序失败并显示 - 项目工厂未找到项目

.Net Coe App in Linux fails with - ProjectFactory did not find Project

以下是我的服务器环境

我在找什么

我创建了一个 .Net 核心测试应用程序并尝试 运行 该应用程序使用以下内容,一切正常。应用 运行“Hello World!”很好,一切正常。

dotnet new console
dotnet run

但是当我尝试发布 运行 应用程序时,

dotnet publish -c Release 
dotnet -d contest.dll

出现以下错误,我已经确定路径和文件名都是正确的。

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)

我试过API、控制台和其他模板。所有人的错误都一样。

非常感谢任何帮助。

非常感谢和问候

先尝试 dotnet contest.dll。请注意命令中缺少选项 -d

即便如此,它也不会 运行 很可能是权限问题。用户是否有可执行权限? 您可以尝试使用 chmod ### directory/where/dotnet/publish is done 授予权限。尝试授予 777 权限并检查。

如果其他用户使用了 chmod 命令,您也可以尝试使用命令 rm /tmp/NuGetScratch/lock/*/tmp/NuGetScratch/lock/ 清除 Nuget 缓存文件。如果多个用户可以访问 lock 目录,有时 nuget 锁定文件确实会产生问题。