Skip to content

Instantly share code, notes, and snippets.

@mtemel123
Last active May 12, 2022 02:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtemel123/95602d31625a668bf72dff7d2681bc11 to your computer and use it in GitHub Desktop.
Save mtemel123/95602d31625a668bf72dff7d2681bc11 to your computer and use it in GitHub Desktop.
#cd D:\code\22 ==> myrepo
$projecttype=2 #1-) console 2-) web
$url="https://github.com/dodyg/practical-aspnetcore/blob/net6.0/projects/connection-info/Program.cs"
if($args.length -ne 0) {
$projecttype=$args[0]
$url=$args[1]
}
$pn ='del_project' #project name
$url = $url.replace('https://github','https://raw.githubusercontent').Replace('/blob','')
if (Test-Path -Path $pn) {
$g= new-guid
$g= "_" + $g
$pn=$pn+$g
}
if($projecttype -eq 1){ $projecttype='console'} else {$projecttype='web'}
$content= (Invoke-webrequest -URI "$url").Content
mkdir $pn
cd .\$pn\
dotnet new $projecttype --name $pn
"//$projecttype `n" + $content > .\$pn\Program.cs
dotnet new sln --name $pn
dotnet sln add $pn
start devenv .\$pn.sln
cls
exit
#ex vs-fast-open-github.ps1 2 https://github.com/dodyg/practical-aspnetcore/blob/net6.0/projects/response/response-header/Program.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment