How to create Content Templates (Blueprints) programmatically

,

Hello,

I need to create a Content Template via C#. I am trying to create it from scratch, which means that I don’t have and don’t need a node in the content tree. What I have tried so far is the following:

  public void CreateBlueprint(string culture)
  {
      IContent guidedCookingBlueprint = _contentService.Create("MyBlueprint", Umbraco.Cms.Core.Constants.System.Root, "article");
      _contentService.SaveBlueprint(guidedCookingBlueprint);
  }

This version threw the following error: “Cannot save content with an empty name”. I figured out it is something with the ContentCultureInfos and tried adding this line in the snippet.

 public void CreateBlueprint(string culture)
 {
     IContent guidedCookingBlueprint = _contentService.Create("MyBlueprint", Umbraco.Cms.Core.Constants.System.Root, "article");
     guidedCookingBlueprint.CultureInfos!.Add(new ContentCultureInfos(culture));
     _contentService.SaveBlueprint(guidedCookingBlueprint);
 }

Now, I don’t get an error but nothing is created.

Does anybody have an idea how I can accomplish my goal?