public
Last active

Turn off Always Start When Debugging for all web projects (run within Nuget powershell console)

  • Download Gist
Console command
1
get-project -all | %{ $_.Properties | ?{ $_.Name -eq "WebApplication.StartWebServerOnDebug" } | %{ $_.Value = "False"} }
How to add to your profile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
I've added this as a function in my NuGet PowerShell profile.
 
From the Package Manager Console:
 
PM> $profile # echos path to NuGet_profile.ps1
 
Open that file in a text editor and add the following code:
 
function NoStartOnDebug(){
get-project -all | %{ $_.Properties | ?{ $_.Name -eq "WebApplication.StartWebServerOnDebug" } | %{ $_.Value = "False"} }
Write-Host "'Always Start When Debugging' has been disabled for all web projects."
}
 
To reload your profile with the changes:
PM> . $profile
 
To run the function:
PM> nostartondebug
 
Of course you can use a shorter name. Even better would be if it automatically ran it when a solution was opened...

For me is doesn't work. I think is correct $_.Value = $False

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.