When i use the Octopus Client to create a release using a .netcore application (therefore the netstandard version) i always get an error.
When using the netframework version, this works perfectly fine.
a small repo console app is:
using Octopus.Client;
using Octopus.Client.Model;
using System;
namespace OctopusRelease
{
internal class Program
{
private static OctopusRepository client;
private static readonly string OctopusUrl = "";
private static readonly string OctopusKey = "API-";
private static readonly string OctopusProject = "Chris Test";
private static readonly string OctopusVersion = $"0.0.0.0-{Guid.NewGuid()}";
private static readonly string OctopusChannel = "Default";
private static void Main(string[] args)
{
client = new OctopusRepository(new OctopusServerEndpoint(OctopusUrl, OctopusKey));
try
{
var octopusProject = client.Projects.FindOne(x => x.Name.Equals(OctopusProject));
var channelId = client.Channels.FindByName(octopusProject, OctopusChannel).Id;
client.Releases.Create(new ReleaseResource(OctopusVersion, octopusProject.Id, channelId));
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.ReadLine();
}
}
}
The error is get is “The resource ‘Releases-23542{’ was not found.” - different release number each time obviously.
I’ve done a bit of digging and can see that the client pulls the “location” header, which is always “/api/releases/Releases-23547{?ignoreChannelRules}” (again different release number each time)
It would appear that when using framework, the value in curly braces is removed, but when using the netstandard variation, the opening brace is still included.
I have created a PR on GitHub (https://github.com/OctopusDeploy/OctopusClients/pull/384) which is a workaround for this issue, but it’s in no way elegant
Currently, this is preventing my application from working as i expect, and i’m having to catch the exception and assume that everything was ok…