Skip to content

Commit 47b13d6

Browse files
committed
appveyor: don't use PowerShell to download docfx
1 parent 7ff4aa1 commit 47b13d6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

scripts/build.csx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Collections.Generic;
44
using System.Diagnostics;
55
using System.IO;
6+
using System.Net;
67
using System.Text;
78

89
public bool RunCommand(string cmd, bool showCmd = false, bool logOnErrorOnly = false) {
@@ -116,7 +117,7 @@ if (triggerCloudBuild) {
116117
}
117118

118119

119-
Console.WriteLine(string.Format("GITHUB_TOKEN: {0} set", string.IsNullOrWhiteSpace(githubToken) ? "not": "is"));
120+
Console.WriteLine(string.Format("GITHUB_TOKEN: {0} set", string.IsNullOrWhiteSpace(githubToken) ? "not" : "is"));
120121
Console.WriteLine($"%UNITYPACKAGER_RAISE_ERROR_ON_FAILURE%: {raiseErrorOnFailure}");
121122
Console.WriteLine($"%APPVEYOR_BUILD_FOLDER%: {rootDir}");
122123
Console.WriteLine($"%APPVEYOR_REPO_COMMIT_MESSAGE%: {commitMessage}");
@@ -135,7 +136,7 @@ if (!triggerCloudBuild) {
135136
Console.WriteLine($"sdkproject directory: {projectDir}");
136137

137138
Environment.CurrentDirectory = projectDir;
138-
if(!RunCommand("del /F /S /Q .gitignore")){
139+
if (!RunCommand("del /F /S /Q .gitignore")) {
139140
Console.Error.WriteLine("could not delete .gitignore");
140141
Environment.Exit(1);
141142
}
@@ -177,8 +178,17 @@ if (!triggerCloudBuild) {
177178

178179
//---------- documentation
179180
Console.WriteLine("downloading docfx ...");
180-
if (!RunCommand("powershell Invoke-WebRequest https://github.com/dotnet/docfx/releases/download/v2.14.1/docfx.zip -OutFile docfx.zip", true, true)) {
181-
Console.Error.WriteLine("could not download docfx");
181+
try {
182+
ServicePointManager.Expect100Continue = true;
183+
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
184+
using (WebClient wc = new WebClient()) {
185+
wc.DownloadFile(
186+
"https://github.com/dotnet/docfx/releases/download/v2.14.1/docfx.zip"
187+
, "docfx.zip"
188+
);
189+
}
190+
} catch (Exception ex) {
191+
Console.Error.WriteLine("could not download docfx: " + ex.ToString());
182192
Environment.Exit(1);
183193
}
184194

0 commit comments

Comments
 (0)