NET CLI:当.csproj存在时,dotnet pack命令在正确的文件夹中不起作用



我需要从我的一个项目中创建一个NuGet包。所以我的代码中有以下命令。

CommandUtility.runCommand($"cd {templateGitPath} && mkdir nupkgs");
CommandUtility.runCommand("dotnet pack --no-build --output nupkgs");

但它返回以下错误,尽管我有一个.csproj文件,并且我正在正确的项目文件夹中运行该命令。

MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

我该怎么解决这个问题?

[UPDATE]NuGet包已在bin/Debug文件夹中创建。但可以找到为什么它没有在nupkgs文件夹中创建。

问题在于@viveknuna提到的位置。如果出现这种错误,可能需要检查.csproj文件或位置。

我认为运行此命令的当前目录没有.csproj文件。添加.csproj文件,然后尝试再次运行命令

最新更新