Search code examples
vb.netpowershellvisual-studio-2019batch-processingprojects-and-solutions

Change Visual Studio project property Start action to "Don't open page" in several projects


When I first download our solution from the version control server, I need to set every project Start action property manually. I would like to know if there is any 'unattended' way to do this. I don't mind creating a batch or powershell script, even opening every needed file and search and replace, assuming this property would be in plain text. I wasn't able to find it in the vbproj file.


Solution

  • In vbproj.user the property is <StartAction>, you must change it's value to NoStartPage. I ended up putting together a powershell script (based on other answers at stackOverflow) to help me out with that.

    gci -r -include "*.vbproj.user" |
     foreach-object { $a = $_.fullname; ( get-content $a ) |
     foreach-object { $_ -replace "(?<=<StartAction>).*(?=<\/StartAction>)", "NoStartPage" }  | 
    set-content $a }