From 725c4da1a05391fcc270e024b7d9a6a96ce0fdb1 Mon Sep 17 00:00:00 2001 From: Clint Rutkas Date: Fri, 8 Jun 2018 14:58:28 -0700 Subject: [PATCH] Update dev_box (#49) Update dev_app.ps1 to - UWP Workload - Azure workload - Windows Template Studio - disabling hyper-v and WSL for now since choco would throw errors (will investigate) --- dev_app.ps1 | 61 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/dev_app.ps1 b/dev_app.ps1 index 531def3e..bedad108 100644 --- a/dev_app.ps1 +++ b/dev_app.ps1 @@ -4,6 +4,13 @@ Disable-UAC +#--- Windows Subsystems/Features --- +#choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures +#choco install -y Microsoft-Hyper-V-All -source windowsFeatures +#choco install -y sysinternals +#choco install -y docker-for-windows + +#--- Configuring Windows properties --- #--- Windows Features --- Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions @@ -13,17 +20,53 @@ Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\ Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Value 1 Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2 -#--- Windows Subsystems/Features --- -choco install -y Microsoft-Hyper-V-All -source windowsFeatures -choco install -y Microsoft-Windows-Subsystem-Linux -source windowsfeatures +#--- Enabling developer mode on the system --- +Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowDevelopmentWithoutDevLicense -Value 1 + +#--- VS 2017 uwp and azure workloads + git tools --- +# See this for install args: https://chocolatey.org/packages/VisualStudio2017Community +# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community +# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio#list-of-workload-ids-and-component-ids +choco install visualstudio2017community --package-parameters "--add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Component.Git" +RefreshEnv + +choco install visualstudio2017-workload-universal + +#--- grabbing latest UWP Samples off Github --- +RefreshEnv +cd $env:USERPROFILE\desktop +mkdir UwpSamples +cd UwpSamples +git clone https://github.com/Microsoft/Windows-universal-samples/ + +# installing Windows Template Studio VSIX +#choco was claiming dev 15 can't do this anymore for vsix... odd hasn't been fixed yet +#Install-ChocolateyVsixPackage -PackageName "Windows Template Studio" -VsixUrl $wtsFileUrl.source + +$requestUri = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' +$requestBody = '{"flags":"262","filters":[{"criteria":[{"filterType":"10","value":"windows template studio"}],"sortBy":"0","sortOrder":"2","pageSize":"25","pageNumber":"1"}]}' +$requestHeaders = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" +$requestHeaders.Add('Accept','application/json; api-version=3.2-preview.1') +$requestHeaders.Add('Content-Type','application/json; charset=utf-8') + +$results = Invoke-WebRequest -Uri $requestUri -Method POST -Headers $requestHeaders -Body $requestBody -UseBasicParsing + +$jsonResults = $results.Content | ConvertFrom-Json +$wtsResults = $jsonResults.results[0].extensions | where {$_.extensionName -eq "WindowsTemplateStudio"} +$wtsFileUrl = $wtsResults.versions[0].files | where {$_.assetType -eq "Microsoft.Templates.2017.vsix"} + +$wtsVsix = [System.IO.Path]::GetFileName($wtsFileUrl.source) +$wtsFullPath = [System.IO.Path]::Combine((Resolve-Path .\).Path, $wtsVsix); +Invoke-WebRequest -Uri $wtsFileUrl.source -OutFile $wtsVsix +$vsixInstallerFile = Get-Childitem -Include vsixinstaller.exe -Recurse -Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\" +$wtsArgList = $wtsFullPath + " /q" + +$vsixInstallerResult = Start-Process -FilePath $vsixInstallerFile.FullName -ArgumentList $wtsArgList -Wait -PassThru; -#--- Tools --- -choco install -y visualstudio2017community # See this for install args: https://chocolatey.org/packages/VisualStudio2017Community -choco install -y sysinternals -# choco install -y docker-for-windows +Remove-Item $wtsVsix -# TODO: should pass install args to VS2017 to install additional options +#--- reenabling critial items --- Enable-UAC Enable-MicrosoftUpdate -Install-WindowsUpdate -acceptEula +Install-WindowsUpdate -acceptEula \ No newline at end of file