stride3d / stride3d/stride

Use Directory.Build.props in project template to determine Stride version

Open
#802 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement priority-Low work-estimate-S
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

Is your feature request related to a problem? Please describe.
The version of Stride (Game Studio, etc.) that is used has to match the Stride package versions in the project. Changing that version manually takes some time, as it has to be changed for every Stride package referenced. While this work is done automatically when upgrading a project to a newer version it is harder to downgrade (e.g. to a local build).

Describe the solution you'd like
I propose adding a Directory.Build.props file in the root of the solution that contains

 <PropertyGroup>
   <StrideVersion>4.0.0.X</StrideVersion>
 </PropertyGroup>

and using this property in the referenced packages

  <ItemGroup>
    <PackageReference Include="Stride.Engine" Version="$(StrideVersion)" />
    <PackageReference Include="Stride.Core.Assets.CompilerApp" Version="$(StrideVersion)"
        IncludeAssets="build;buildTransitive" />
  </ItemGroup>

Thus changing Stride's version can be done in one place for all packages.

Alternative approach
Rather than supplying Version for every package reference in the project it's possible to use the Directory.build.targets:

<Project>
  <PropertyGroup>
    <StrideVersion>4.0.0.1-beta04</StrideVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Update="Stride.Engine" Version="$(StrideVersion)" />
    <PackageReference Update="Stride.Video" Version="$(StrideVersion)" />
    <PackageReference Update="Stride.Physics" Version="$(StrideVersion)" />
    <!-- ... -->
  </ItemGroup>
</Project>

Using Update allows us to specify all Stride packages that can be used in a project, even if that particular project only references some of them

<ItemGroup>
  <PackageReference Include="Stride.Engine" />
  <PackageReference Include="Stride.Video" />
  <PackageReference Include="Stride.Core.Assets.CompilerApp" IncludeAssets="build;buildTransitive" />
</ItemGroup>

Additional context
There might need to be a check present that verifies if a project uses this new approach or the current one and updates the project accordingly (via props or via references). This also affects adding dependencies from Stride Game Studio.

I believe this might be broken when adding packages outside of Stride (through dotnet package or VS NuGet Manager), forcing the user to manually change/remove hardcoded Version for new references.

This feature may be deemed unnecessary and left up to the user, but should the user choose to use a property the project update mechanism should not be breaking it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the project templates, package-reference generation, project upgrade mechanism, and the code used when adding dependencies from Stride Game Studio. Check how version changes and new package references are currently written, then ensure a centralized StrideVersion approach can be adopted without breaking existing projects or manually managed external packages.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.