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
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_).
- 1Create 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.
- 2Add the feed on your machine
The command stores the source in your user-level
nuget.config, not in the project.
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 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
dotnet add package RayCraft.Blazor.Complete --source RayCraft
dotnet restore
| Package | What it is for |
|---|---|
RayCraft.Blazor.Complete | Components, styles and scripts (the main package). |
RayCraft.Blazor.Complete.Office | Controls for documents, spreadsheets, presentations and PDF. Requires the main package. |
RayCraft.Blazor.Complete.Editor | Rich text editor (HTML, Markdown, JSON and e-mail). Requires the main package. |
RayCraft.Blazor.Complete.Office.Ocr.Tesseract | Optional: text recognition in scanned PDF pages (Windows only). Requires Office. |
RayCraft.Blazor.Complete.Office.Ocr.Tesseract.Data | Language 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):
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 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:
@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:
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
| Symptom | Cause |
|---|---|
| 401 or 403 on restore | The token is revoked, the license is not active, or another source with the same name replaces the feed. |
| Package not found | The version was released after your license ended: renew, or use an older version. |
| Works locally, not on the build server | The 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).