Basic 3D Scene (Capsule) - File-Based App
The same minimal 3D scene as E01_3D_BasicScene, written as a .NET 10 file-based app: a single C# file with no .csproj. NuGet packages, project references and MSBuild properties are declared inline with #:package, #:project and #:property directives, so the example runs with "dotnet run Program.cs". Use "dotnet project convert" to turn it back into a regular project.
The Program.cs file shows how to:
- Running a Stride game as a .NET 10 file-based app (no .csproj)
- Declaring NuGet packages inline with #:package
- Referencing projects inline with #:project
- Setting MSBuild properties inline with #:property
- Converting a file-based app to a project with dotnet project convert
- Using helpers: SceneSetup3D, UseSkybox

View on GitHub.
// Basic 3D Scene as a .NET 10 file-based app - the same scene as E01_3D_BasicScene, but with
// no .csproj at all. Everything the build needs is declared by the #: directives below.
//
// Run: dotnet run Program.cs
// Build: dotnet build Program.cs
// Convert: dotnet project convert Program.cs (emits a regular .csproj next to this file)
//
// Requires the .NET 10 SDK. Because there is no project file, this example is not part of
// Stride.CommunityToolkit.slnx and Visual Studio will not build it with the rest of the solution -
// run it from the command line.
#:package Stride.BepuPhysics.Debug@$(StrideVersion)
#:project ../../../src/Stride.CommunityToolkit.Bepu/Stride.CommunityToolkit.Bepu.csproj
#:project ../../../src/Stride.CommunityToolkit.Skyboxes/Stride.CommunityToolkit.Skyboxes.csproj
#:project ../../../src/Stride.CommunityToolkit/Stride.CommunityToolkit.csproj
#:property PublishAot=false
// Stride before 4.4.0 built its asset cache path by concatenating $(ProjectDir) with
// $(IntermediateOutputPath). A file-based app's obj/ and bin/ live under the SDK's temp cache, so
// that path is absolute, and the build failed with an IOException on a malformed path.
//
// On such a Stride build, uncomment the two directives below. They force obj/ and bin/ next to
// this file, which costs the SDK's shared temp build cache.
//
// #:property BaseIntermediateOutputPath=obj\
// #:property OutputPath=bin\
using Stride.CommunityToolkit.Bepu;
using Stride.CommunityToolkit.Engine;
using Stride.CommunityToolkit.Rendering.ProceduralModels;
using Stride.CommunityToolkit.Skyboxes;
using Stride.Core.Mathematics;
using Stride.Engine;
using var game = new Game();
game.Run(new SceneSetup3D().UseBepu().UseSkybox(), start: Start);
void Start(Scene rootScene)
{
var entity = game.CreatePrimitive(Primitive3D.Capsule());
entity.Transform.Position = new Vector3(0, 8, 0);
entity.Scene = rootScene;
}