Skip to content

Commit fecd4ea

Browse files
authored
- New scripts/Makefile step "setup" installs all required .NET versions and third-party tools (#299)
1 parent a2f6446 commit fecd4ea

File tree

4 files changed

+55
-2
lines changed

4 files changed

+55
-2
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,8 @@ scan:
8080
security-scan --verbose --no-banner --ignore-msbuild-errors EasyPost.sln
8181
# "--ignore-msbuild-errors" needed since MSBuild does not like F#: https://github.com/security-code-scan/security-code-scan/issues/235
8282

83+
## setup - Install required .NET versions and tools (Windows only)5
84+
setup:
85+
scripts\setup.bat
86+
8387
.PHONY: help release build-dev build install-cert sign clean restore lint lint-check test lint-scripts install-scanner scan

scripts/publish_all_nuget.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:: This script will find and publish any NuGet packages to Nuget.org
1+
:: This script will find and publish any NuGet packages to Nuget.org
22

33
:: Requirements:
44
:: - NuGet is installed on the machine and is accessible everywhere (added to PATH)

scripts/publish_nuget.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
:: This script will find and publish a NuGet packages to Nuget.org
1+
:: This script will find and publish a NuGet packages to Nuget.org
22

33
:: Requirements:
44
:: - NuGet is installed on the machine and is accessible everywhere (added to PATH)

scripts/setup.bat

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
:: This script will:
2+
:: - use Microsoft's PowerShell script (https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script) to install the latest version of all required .NET SDKs.
3+
:: - install required third-party tools for running these scripts
4+
:: - add files to the current user's PATH environment variable
5+
6+
:: Requirements:
7+
:: - PowerShell is enabled on the machine
8+
:: - Do not install dotnet via any other method (including via installing Visual Studio/Rider). This might otherwise cause two conflicting versions of 'dotnet' to exist in your PATH
9+
10+
@ECHO OFF
11+
12+
:: .NET Versions we want to install and destination
13+
SET NetVersions=Current 6.0 5.0 3.1
14+
SET InstallPath=C:\dotnet
15+
16+
:: Dependencies for these scripts
17+
SET DepFiles=SnInstallPfx.exe nuget.exe 7z.exe
18+
SET FileHost=https://files.nateharr.is/netdeps/
19+
20+
:: Install each .NET version
21+
@ECHO Installing .NET SDKs ...
22+
SETLOCAL
23+
for %%x IN (%NetVersions%) DO (
24+
@ECHO Installing .NET %%x ...
25+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) -InstallDir %InstallPath% -Channel %%x -Verbose"
26+
)
27+
ENDLOCAL
28+
29+
:: Download dependencies to the same directory as 'dotnet'
30+
@ECHO Downloading third-party tools ...
31+
SETLOCAL
32+
for %%x IN (%DepFiles%) DO (
33+
@ECHO Downloading %%x ...
34+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "Invoke-WebRequest -Uri '%FileHost%%%x' -OutFile '%InstallPath%\%%x'"
35+
)
36+
ENDLOCAL
37+
38+
:: Add dotnet folder to PATH
39+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Environment]::SetEnvironmentVariable('Path', $env:Path + ';%InstallPath%', 'User')"
40+
41+
EXIT /B 0
42+
43+
:commandFailed
44+
@ECHO Command failed.
45+
GOTO :exitWithError
46+
47+
:exitWithError
48+
@ECHO Exiting...
49+
EXIT /B 1

0 commit comments

Comments
 (0)