Install VSCode and enviroment path using Powershell
Set-ExecutionPolicy Bypass -Scope Process -Force;
$remoteFile = 'https://go.microsoft.com/fwlink/?Linkid=850641';
$downloadFile = $env:Temp+'\vscode.zip';
$vscodePath = $env:LOCALAPPDATA+"\VsCode";
(New-Object Net.WebClient).DownloadFile($remoteFile, $downloadFile);
Expand-Archive $downloadFile -DestinationPath $vscodePath -Force
$env:Path += ";"+$vscodePath
[Environment]::SetEnvironmentVariable
("Path", $env:Path, [System.EnvironmentVariableTarget]::User);
Install NodeJS and enviroment path using Powershell
Set-ExecutionPolicy Bypass -Scope Process -Force;
$remoteFile = 'https://nodejs.org/dist/v12.13.0/node-v12.13.0-win-x64.zip';
$downloadFile = $env:Temp+'\node-v12.13.0-win-x64.zip';
$nodePath = $env:LOCALAPPDATA+"\Node";
(New-Object Net.WebClient).DownloadFile($remoteFile, $downloadFile);
Expand-Archive $downloadFile -DestinationPath $nodePath -Force
$env:Path += ";"+$nodePath
[Environment]::SetEnvironmentVariable
("Path", $env:Path, [System.EnvironmentVariableTarget]::User);
Next step, you can install yarn via command promt
npm install yarn -g
Install dotnet and enviroment path using Powershell
Set-ExecutionPolicy Bypass -Scope Process -Force;
$remoteFile = 'https://dot.net/v1/dotnet-install.ps1';
$downloadFile = 'dotnet-install.ps1';
$dotnetPath = $env:LOCALAPPDATA+"\Microsoft\Dotnet";
(New-Object Net.WebClient).DownloadFile($remoteFile, $downloadFile);
$env:Path += ";"+$dotnetPath
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User);
Now you are all set, your development machine is ready to go. To create a React app, just open a command line window and type these commands:
yarn create react-app reactapp --typescript
cd reactapp
yarn start
If you point your browser to localhost:3000, you will see:
Running Code . will open VS Code with the project folder open:
You can also create an Asp.NET Core MVC with the commands:
dotnet new mvc -o AspNetApp
cd AspNetApp
dotnet run
And open localhost:5000 in the browser to see the app running:
As you can see, with a few steps, you can setup a developer machine with no need of admin rights nor the need of any license, you can now start developing your full apps and debug them in VS Code.
That way, I could start and run from day one, and when the full install came, I was already developing.
After finishing the setting, I noticed that all the scripts are very similar, so I created a single script, Install-FromWeb:
[CmdletBinding()]
Param (
$RemoteFile,
$DownloadFile,
[bool]$DoExtractFile = $False,
[string]$ExecutePath = $null,
$AddedPath
)
Write-Host $RemoteFile
Write-Host $DownloadFile
Invoke-WebRequest -Uri $RemoteFile -OutFile $DownloadFile
If ($DoExtractFile){
Expand-Archive $DownloadFile -DestinationPath $AddedPath -Force
}If (-Not ([string]::IsNullOrEmpty($ExecutePath))){
& "$ExecutePath"
} $env:Path += ";"+$AddedPath
[Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User);
When I was pushing the data to my GitHub, I noticed that Git for Windows gitforwindows.org wasn’t installed. I checked the Git for Windows site and there is a portable version in PortableGit-2.24.0.2-64-bit.7z.exe. With it, you can use Git as a version control system. With that, you can install your machine with a single set of instructions:
Set-ExecutionPolicy Bypass -Scope Process -Force;
.\Install-FromWeb.ps1 -RemoteFile "https://go.microsoft.com/fwlink/?Linkid=850641" -DownloadFile $env:Temp"\vscode.zip" -DoExtractFile $true -AddedPath $env:LOCALAPPDATA"\VsCode"
.\Install-FromWeb.ps1 -RemoteFile 'https://nodejs.org/dist/v12.13.0/node-v12.13.0-win-x64.zip' -DownloadFile $env:Temp'\node-v12.13.0-win-x64.zip' -DoExtractFile $true -AddedPath $env:LOCALAPPDATA"\Node"
Move-Item -Path $env:LOCALAPPDATA"\Node\node-v12.13.0-win-x64" -Destination $env:LOCALAPPDATA"\Node1"
Remove-item -Path $env:LOCALAPPDATA"\Node"
Rename-item -Path $env:LOCALAPPDATA"\Node1" -NewName $env:LOCALAPPDATA"\Node"
npm install yarn -g
.\Install-FromWeb.ps1 -RemoteFile 'https://dot.net/v1/dotnet-install.ps1' -DownloadFile $env:Temp'\dotnet-install.ps1' -DoExtractFile $false -AddedPath $env:LOCALAPPDATA'\Microsoft\Dotnet' -ExecutePath $env:Temp'\dotnet-install.ps1'
.\Install-FromWeb.ps1 -RemoteFile 'https://github.com/git-for-windows/git/releases/download/v2.24.0.windows.2/PortableGit-2.24.0.2-64-bit.7z.exe' -DownloadFile $env:TEMP'\PortableGit.exe' -DoExtractFile $false -AddedPath $env:LOCALAPPDATA'\Git' -Debug
$env:TEMP'\PortableGit.exe' -o $env:LOCALAPPDATA'\Git' -y
P/s: This post only for note purpose
Top comments (0)