File tree Expand file tree Collapse file tree 3 files changed +40
-10
lines changed
Expand file tree Collapse file tree 3 files changed +40
-10
lines changed Original file line number Diff line number Diff line change 1+ <Project >
2+ <PropertyGroup >
3+ <DeployPropertiesFile >DeployProperties.g.cs</DeployPropertiesFile >
4+ </PropertyGroup >
5+
6+ <Target Name =" WriteDeployProperties" BeforeTargets =" BeforeCompile;CoreCompile" Outputs =" $(IntermediateOutputPath)$(DeployPropertiesFile)" >
7+ <PropertyGroup >
8+ <DeployPropertiesFilePath >$(IntermediateOutputPath)$(DeployPropertiesFile)</DeployPropertiesFilePath >
9+ </PropertyGroup >
10+
11+ <ItemGroup >
12+ <DeployAttributes Include =" osu.Game.Utils.OfficialBuildAttribute" >
13+ <_Parameter1 >$(Version)</_Parameter1 >
14+ </DeployAttributes >
15+ </ItemGroup >
16+
17+ <WriteCodeFragment AssemblyAttributes =" @(DeployAttributes)" Language =" C#" OutputFile =" $(DeployPropertiesFilePath)" >
18+ <Output TaskParameter =" OutputFile" ItemName =" Compile" />
19+ <Output TaskParameter =" OutputFile" ItemName =" FileWrites" />
20+ </WriteCodeFragment >
21+ </Target >
22+ </Project >
Original file line number Diff line number Diff line change @@ -125,13 +125,9 @@ public virtual string Version
125125 if ( ! IsDeployedBuild )
126126 return @"local " + ( DebugUtils . IsDebugBuild ? @"debug" : @"release" ) ;
127127
128- string informationalVersion = Assembly . GetEntryAssembly ( ) ?
129- . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ?
130- . InformationalVersion ;
131-
132- // Example: [assembly: AssemblyInformationalVersion("2025.613.0-tachyon+d934e574b2539e8787956c3c9ecce9dadebb10ee")]
133- if ( ! string . IsNullOrEmpty ( informationalVersion ) )
134- return informationalVersion . Split ( '+' ) . First ( ) ;
128+ OfficialBuildAttribute buildAttribute = RuntimeInfo . EntryAssembly . GetCustomAttribute < OfficialBuildAttribute > ( ) ;
129+ if ( buildAttribute != null )
130+ return buildAttribute . Version ;
135131
136132 Version version = AssemblyVersion ;
137133 return $@ "{ version . Major } .{ version . Minor } .{ version . Build } -lazer";
Original file line number Diff line number Diff line change 22// See the LICENCE file in the repository root for full licence text.
33
44using System ;
5- using JetBrains . Annotations ;
65
76namespace osu . Game . Utils
87{
9- [ UsedImplicitly ]
8+ /// <summary>
9+ /// This attribute is automatically attached to assemblies of projects built with a <c>Version</c> property specified.
10+ /// It is purely informational - used to alert the user of the (lack of) online capabilities and of the game's version.
11+ /// <p />
12+ /// Refer to <c>Deploy.props</c> in the repository root for how this attribute is attached.
13+ /// </summary>
1014 [ AttributeUsage ( AttributeTargets . Assembly ) ]
11- public class OfficialBuildAttribute : Attribute ;
15+ public class OfficialBuildAttribute : Attribute
16+ {
17+ public readonly string Version ;
18+
19+ public OfficialBuildAttribute ( string version )
20+ {
21+ Version = version ;
22+ }
23+ }
1224}
You can’t perform that action at this time.
0 commit comments