Skip to content

fix(msbuild): Stride.AssetCompiler.targets - use MSBuild::NormalizePath to normalize paths - #3340

Merged
xen2 merged 4 commits into
stride3d:masterfrom
VaclavElias:asset-path
Aug 14, 2026
Merged

xen2 merged 4 commits into
stride3d:masterfrom
VaclavElias:asset-path

Conversation

@VaclavElias

Copy link
Copy Markdown
Contributor

PR Classification

Bug fix to ensure correct path handling in asset build processes.

PR Summary

Replaced string concatenation with System.IO.Path.Combine for StrideCompileAssetBuildPath and StrideCompileAssetUpToDateCheckFileBase in Stride.AssetCompiler.targets, ensuring intermediate output paths are handled correctly for both normal projects and file-based apps (dotnet run app.cs), whose obj/bin paths are already rooted under the SDK's temp cache.

  • Stride.AssetCompiler.targets: use Path.Combine instead of concatenation for StrideCompileAssetBuildPath and StrideCompileAssetUpToDateCheckFileBase; added explanatory comments

Testing notes

This PR fixes StrideCompileAssetBuildPath and StrideCompileAssetUpToDateCheckFileBase to use
Path.Combine instead of string concatenation, so absolute intermediate paths (e.g. file-based
apps via dotnet run app.cs, whose obj/bin live under the SDK's temp cache) are handled correctly
instead of producing a malformed path.

Verified on Windows. Path.Combine/Path.IsPathRooted rootedness semantics can differ slightly
across platforms, so it would be good to double check normal + file-based app builds on
Linux/macOS, if a maintainer has the setup handy.

- Use Path.Combine for StrideCompileAssetBuildPath and
  StrideCompileAssetUpToDateCheckFileBase
- Fixes malformed paths for file-based apps (dotnet run app.cs) whose
  intermediate output paths are already rooted
@VaclavElias
VaclavElias requested a review from xen2 August 8, 2026 18:07
@VaclavElias

Copy link
Copy Markdown
Contributor Author

References: https://learn.microsoft.com/en-us/dotnet/core/sdk/file-based-apps

Additional context, this change will allow to run Stride (code-only) from any C# file e.g. Program.cs without a project file csproj like the example below.

Without this PR, we have to add also these two lines

#:property BaseIntermediateOutputPath=obj\
#:property OutputPath=bin\
#:package Stride.CommunityToolkit.Bepu@1.0.0-dev
#:package Stride.CommunityToolkit.Skyboxes@1.0.0-dev
#:package Stride.CommunityToolkit.Windows@1.0.0-dev

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(start: Start);

void Start(Scene rootScene)
{
    game.SetupBase3DScene();
    game.AddSkybox();

    var entity = game.Create3DPrimitive(PrimitiveModelType.Capsule);
    entity.Transform.Position = new Vector3(0, 8, 0);
    entity.Scene = rootScene;
}

Comment thread sources/assets/Stride.AssetCompiler/build/Stride.AssetCompiler.targets Outdated
@VaclavElias
VaclavElias requested a review from xen2 August 13, 2026 23:21
@VaclavElias VaclavElias changed the title fix(msbuild): Stride.AssetCompiler.targets - use Path.Combine for paths fix(msbuild): Stride.AssetCompiler.targets - use MSBuild::NormalizePath to normalize paths Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants