stride3d/stride · error · OptionException
Need two extra arguments
Error message
Need two extra arguments
What it means
The pack-assets command requires exactly two extra arguments: the C# project file and the intermediate package path. RealMain checks commandArgs.Count != 3 and throws OptionException when the count differs.
Solutions
- Invoke as: Stride.Core.Tasks pack-assets <csprojFile> <intermediatePackagePath>.
- Quote paths containing spaces so they count as one argument.
- Pass host-loadable asset assemblies via repeated --pack-asset-assembly= options, not positional args.
Example fix
// before Stride.Core.Tasks pack-assets MyGame.csproj // after Stride.Core.Tasks pack-assets MyGame.csproj "bin\Intermediate"
Defensive patterns
Strategy: validation
Validate before calling
if (args.Length < 3 || args[0] != "pack-assets")
{
Console.WriteLine("Usage: Stride.Core.Tasks pack-assets <csproj> <intermediatePath> [--pack-asset-assembly=<dll>]...");
return 1;
} Try / catch
try { return RealMain(args); }
catch (OptionException ex) { Console.Error.WriteLine(ex.Message + " — expected: pack-assets <csproj> <intermediatePath>"); return 1; } Prevention
- Always supply both csproj and intermediate package path
- Quote paths containing spaces
- Pass assemblies via --pack-asset-assembly= flags, not positionally
When it happens
Trigger: Running 'Stride.Core.Tasks pack-assets' with fewer or more than two extra arguments.
Common situations: Omitting the intermediate package path in a build script; paths containing spaces not quoted, splitting into extra arguments; appending extra flags positionally.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- You need to specify a command
- Need one extra argument
- Host pipe not specified
- The provided path is not a valid path name.
- Build manifest [ ] doesn't exist
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/af64243ad0ef8e1e.
Report an issue: GitHub.
Appendix: source
Thrown at sources/core/Stride.Core.Tasks/Program.cs:100
{
if(!OperatingSystem.IsWindows())
throw new OptionException("This option is only available on Windows", "");
if (commandArgs.Count != 2)
throw new OptionException("Need one extra argument", "");
var devenvPath = LocateDevenv.FindDevenv(commandArgs[1]);
if (devenvPath == null)
{
Console.WriteLine("Could not locate devenv");
return 1;
}
Console.WriteLine(devenvPath);
break;
}
case "pack-assets":
{
if (commandArgs.Count != 3)
throw new OptionException("Need two extra arguments", "");
var csprojFile = commandArgs[1];
var intermediatePackagePath = commandArgs[2];
// Host-loadable asset assemblies are passed as repeated --pack-asset-assembly= options.
var generatedItems = new List<(string SourcePath, string PackagePath)>();
var logger = new LoggerResult();
if (!PackAssetsHelper.Run(logger, csprojFile, intermediatePackagePath, generatedItems, packAssetAssemblies))
{
foreach (var message in logger.Messages)
{
Console.WriteLine(message);
}
return 1;
}
foreach (var generatedItem in generatedItems)
{
Console.WriteLine($"{generatedItem.SourcePath}|{generatedItem.PackagePath}");
}View on GitHub (pinned to 96fad776d2)