Aborting an "unclosed" powershell command in Visual Studio Nuget Package manager console

I accidently issued an invalid PowerShell command in the NuGet Package Manager console and locked the console. The command was

PM> Get-Project -all | Where { $_.ProjectName -imatch "GPEC.Personne }

then the console displayed >> as prompt and I was unable to leave this mode. Closing and reopening the console did not help. (Had to restart VS). Is there a way to gracefully cancel a wrong command in this case and return to the standard PM> prompt?

Thanks in advance. Philippe


That appears to be buggy behavior. The >> indicates that syntactically the current command isn't finished. That is, you have opened a double quoted string but haven't finished it. Press the "Clear Console" toolbar button to escape out of this mode.

In the VS console window there's a "Stop Command Execution" button (a red square if enabled). It's next to the "Clear Console" button. The button is only enabled if a command is actually running.

Based on the accepted answer, it seems OP didn't actually need to abort an executing command. But this answer should prove useful to anyone who really does need to abort a command.

It's a simple question, that's already been answered but I think I might have something to add. In terms of clarifying the behavior of the Nuget Console.

This happens when you open a statement with a single/double quotation and don't close it properly or don't close it at all.

Example (Respectively)

Add-Migraion "Add 'Employee' Model'


Add-Migraion "Add 'Employee' Model

The console will assume that you need to break the command into two lines so it will wait for you to finish the command or close the statement on another line by showing this symbol >>. In such case if that happened by mistake all you have to do is type " or ' based on how you opened the statement.

Sometimes you can look in the regular Windows task manager and kill the task. Can be difficult to find though.

I cringe just posting this.

There's a Debuggable Package Manager program installed with Visual Studio (not sure which version this began with).

You will need to manually CD to the correct folder for your project, but it can be more reliable for certain tasks and you can open multiple windows too which can be nice.

And yes - CTRL+C works to terminate the task :-)

Need Your Help

what is the CLSID and PROG ID of Microsoft.sqlserver.Management.Smo

c# c++ sql-server visual-c++ smo

Can any Body tell me wher can i get CLSID and ProgID of Smo library??

UIActivityViewController's share feature without the view controller

ios uiactivityviewcontroller

Is there a way to skip the modal presentation of a UIActivityViewController and launch the built-in edit view of each of the services (i.e. Twitter) directly?