Kalpani
Kalpani

Reputation: 185

.NET CLI : dotnet pack command is not working in correct folder and when .csproj exists

I need to create a NuGet package from one of my projects. So I have the following command in my code.

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

But it returns the following error although I have a .csproj file and I'm running the command in the right project folder.

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

How can I fix this?

[UPDATE] NuGet package has created in bin/Debug folder. But could find why it's not get created inside the nupkgs folder.

Upvotes: 0

Views: 739

Answers (2)

Kalpani
Kalpani

Reputation: 185

The issue was with the location as the @viveknuna has mentioned. If you get this kind of error probably check for the .csproj file or the location.

Upvotes: 1

Amit Kotha
Amit Kotha

Reputation: 2019

I think the current directory where you are running this command does not have .csproj file.Add the .csproj file and then try to run command again

Upvotes: 0

Related Questions