diff --git a/.vsts.service.ci.yml b/.vsts.service.ci.yml
index 92e93d2f..820436f9 100644
--- a/.vsts.service.ci.yml
+++ b/.vsts.service.ci.yml
@@ -19,8 +19,10 @@ steps:
- task: DotNetCoreCLI@2
displayName: Copy sdk files locally before build
inputs:
+ command: custom
projects: src/SignService/SignService.csproj
- arguments: '-c $(BuildConfiguration) /t:PrebuildScript'
+ custom: msbuild
+ arguments: '/p:Configuration=$(BuildConfiguration) /t:PrebuildScript'
- task: DotNetCoreCLI@2
displayName: Build and Publish
diff --git a/src/Directory.build.props b/src/Directory.build.props
index 547b6e5f..123bc3ae 100644
--- a/src/Directory.build.props
+++ b/src/Directory.build.props
@@ -1,10 +1,14 @@
latest
+ true
+ true
+ $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb
+
\ No newline at end of file
diff --git a/src/SignClient/SignCommand.cs b/src/SignClient/SignCommand.cs
index dc4a467a..2427aab4 100644
--- a/src/SignClient/SignCommand.cs
+++ b/src/SignClient/SignCommand.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
+using System.Security.Authentication;
using System.Threading.Tasks;
using Microsoft.Extensions.CommandLineUtils;
using Microsoft.Extensions.Configuration;
@@ -90,21 +91,28 @@ CommandOption descriptionUrl
// Cannot use ADAL since there's no support for ROPC in .NET Core
var parameters = new Dictionary
{
- {"resource", resourceId },
- {"client_id", clientId },
- {"grant_type", "password" },
- {"username", username.Value() },
- {"password", clientSecret.Value() },
+ {"resource", resourceId},
+ {"client_id", clientId},
+ {"grant_type", "password"},
+ {"username", username.Value()},
+ {"password", clientSecret.Value()},
};
using (var adalClient = new HttpClient())
{
var result = await adalClient.PostAsync($"{authority}/oauth2/token", new FormUrlEncodedContent(parameters));
var res = await result.Content.ReadAsStringAsync();
- result.EnsureSuccessStatusCode();
-
+
var jObj = JObject.Parse(res);
- var token = jObj["access_token"].Value();
+
+ if (!result.IsSuccessStatusCode)
+ {
+ var desc = jObj["error_description"].Value();
+ throw new AuthenticationException(desc);
+ }
+
+ var token = jObj["access_token"]
+ .Value();
return token;
}
}
@@ -146,6 +154,11 @@ CommandOption descriptionUrl
await str.CopyToAsync(fs);
}
}
+ catch (AuthenticationException e)
+ {
+ signCommandLineApplication.Error.WriteLine(e.Message);
+ return EXIT_CODES.FAILED;
+ }
catch (Exception e)
{
signCommandLineApplication.Error.WriteLine("Exception: " + e);