currently, I'm developing an Alexa skill that can return work items from DevOps. For this, I'm using the Aws Toolkit for Visual Studio.
Now I want to know if it's possible to include NuGet Packages from our DevOps organization.
Basically something like this:
using Amazon.Lambda.Core;
using Newtonsoft.Json;
using Slight.Alexa.Framework.Models.Requests;
using Slight.Alexa.Framework.Models.Responses;
// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]
namespace AlexaDevOpsSkill
{
public class Function
{
/// <summary>
/// Searches for a work item.
/// </summary>
/// <param name="input"></param>
/// <param name="context"></param>
/// <returns></returns>
public string FunctionHandler(SkillRequest input, ILambdaContext context)
{
IOutputSpeech outputSpeech = null;
if (input.Request.Intent.Name == "SearchIntent")
{
MyNuGetPackage.DevOpsItem devOpsItem = MyNuGetPackage.GetWorkItem(input.Request.Intent.Slots["Id"]);
outputSpeech = new PlainTextOutputSpeech() { Text = $"I found the workitem: {devOpsItem.Name}" };
}
Response response = new Response() { OutputSpeech = outputSpeech };
SkillResponse skillResponse = new SkillResponse() { Response = response };
return JsonConvert.SerializeObject(skillResponse);
}
}
}
I'm aware, that there is a NuGet package that allows me to search for work items at nuget.org but I want to include other functions from different NuGet packages someday. This is just my current example.
When installing a Nuget Package from a different source I can't even reference it in the function.cs document.
If this is not possible with AWS, can I host my function on DevOps for Alexa to use it?
You can define multiple sources for packages in the NuGet.Config
file in the repository root (create it if it doesn't exist).
Something like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="MyCompanySource" value="https://nuget.mycompany.org/repository/index.json" />
</packageSources>
</configuration>
The exact configuration you need to specify will depend on the type of your local nuget server and its configuration. The default nuget.org source is already specified by the system-wide nuget.config, therefore you don't need to add it.