RayCraftDocs
v1.0.3 raycraft.dev
On this page

Getting started

RayCraft Free comes from nuget.org. RayCraft Complete comes from a private NuGet feed and needs an active license and an access token.

1. RayCraft Free

bash
dotnet add package RayCraft.Blazor

2. RayCraft Complete

The feed is https://nuget.raycraft.dev/v3/index.json, the user name is rcf and the password is your token (it starts with rcf_).

  • 1
    Create a token

    Sign in at auth.raycraft.dev, open Package access and create a token. It is shown only once, so copy it right away. You can have up to 10 tokens per license; a revoked token stops working immediately.

  • 2
    Add the feed on your machine

    The command stores the source in your user-level nuget.config, not in the project.

bash
dotnet nuget add source https://nuget.raycraft.dev/v3/index.json --name RayCraft --username rcf --password <YOUR_TOKEN> --store-password-in-clear-text

--store-password-in-clear-text is needed on Linux, macOS and build agents. On Windows you can omit it and the password is encrypted for your user.

Keep the token secret. Do not put it in the repository, in a nuget.config that is committed, or in e-mails to support (the last 4 characters are enough).

Build server

Commit a nuget.config that reads the token from a variable, and set RAYCRAFT_FEED_TOKEN as a secret in your build system.

xml
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="RayCraft" value="https://nuget.raycraft.dev/v3/index.json" />
  </packageSources>
  <packageSourceCredentials>
    <RayCraft>
      <add key="Username" value="rcf" />
      <add key="ClearTextPassword" value="%RAYCRAFT_FEED_TOKEN%" />
    </RayCraft>
  </packageSourceCredentials>
</configuration>

Install the packages

bash
dotnet add package RayCraft.Blazor.Complete --source RayCraft
dotnet restore
PackageWhat it is for
RayCraft.Blazor.CompleteComponents, styles and scripts (the main package).
RayCraft.Blazor.Complete.OfficeControls for documents, spreadsheets, presentations and PDF. Requires the main package.
RayCraft.Blazor.Complete.EditorRich text editor (HTML, Markdown, JSON and e-mail). Requires the main package.
RayCraft.Blazor.Complete.Office.Ocr.TesseractOptional: text recognition in scanned PDF pages (Windows only). Requires Office.
RayCraft.Blazor.Complete.Office.Ocr.Tesseract.DataLanguage models for the previous package.

Do not install the free RayCraft.Blazor in the same application as Complete: they have the same assembly and namespace names. The packages work with Server, WebAssembly and Auto.

Register and use

In Program.cs (for WebAssembly and Auto, also in the client project):

csharp
using RayCraft.Blazor;
using RayCraft.Blazor.Office;

builder.Services.AddRayCraft();
builder.Services.AddRayCraftOffice();

In Components/App.razor set the theme on html and add the files:

html
<html lang="en" data-raycraft-theme="light">
<head>
    <link rel="stylesheet" href="_content/RayCraft.Blazor/css/raycraft.css" />
    <link rel="stylesheet" href="_content/RayCraft.Blazor.Office/css/raycraft-office.css" />
</head>
<body>
    <Routes @rendermode="InteractiveServer" />
    <script src="_content/RayCraft.Blazor/raycraft.js"></script>
    <script src="_framework/blazor.web.js"></script>
</body>
</html>

In Components/_Imports.razor:

razor
@using RayCraft.Blazor
@using RayCraft.Blazor.Components

The controls can then be used directly, for example <ThemeMenu />, <DialogHost /> and <SnackbarHost />. The AddRayCraftOffice line and the Office stylesheet are only needed with the Office package.

The dotnet new blazor template has its own Components/Layout/NavMenu.razor with the same tag name as the package NavMenu, and the build stops with RZ9985. Delete it and remove its use from MainLayout.razor.

Check access

Without a token the feed answers 401, which shows that the address is right and access is protected. With a token, a read-only check:

bash
curl -s -u rcf:$RAYCRAFT_FEED_TOKEN https://nuget.raycraft.dev/v3/index.json

Expected: JSON with version and a list of resources.

Common problems

SymptomCause
401 or 403 on restoreThe token is revoked, the license is not active, or another source with the same name replaces the feed.
Package not foundThe version was released after your license ended: renew, or use an older version.
Works locally, not on the build serverThe token variable is not set.

For anything else write to support@raycraft.dev with the package name and version, platform, .NET version and the feed lines from dotnet restore -v d (without the token).