mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-02-05 14:49:06 +00:00
Read metadata to update project information
This commit is contained in:
parent
5b194d7b4b
commit
1c9f075955
33
app/MindWork AI Studio/MetaDataAttribute.cs
Normal file
33
app/MindWork AI Studio/MetaDataAttribute.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
namespace AIStudio;
|
||||||
|
|
||||||
|
[AttributeUsage(AttributeTargets.Assembly)]
|
||||||
|
public class MetaDataAttribute(
|
||||||
|
string version,
|
||||||
|
string buildTime,
|
||||||
|
uint buildNum,
|
||||||
|
string dotnetSdkVersion,
|
||||||
|
string dotnetVersion,
|
||||||
|
string rustVersion,
|
||||||
|
string mudBlazorVersion,
|
||||||
|
string tauriVersion,
|
||||||
|
string appCommitHash
|
||||||
|
) : Attribute
|
||||||
|
{
|
||||||
|
public string BuildTime { get; } = buildTime;
|
||||||
|
|
||||||
|
public string Version { get; } = version;
|
||||||
|
|
||||||
|
public uint BuildNum { get; } = buildNum;
|
||||||
|
|
||||||
|
public string DotnetVersion { get; } = dotnetVersion;
|
||||||
|
|
||||||
|
public string DotnetSdkVersion { get; } = dotnetSdkVersion;
|
||||||
|
|
||||||
|
public string RustVersion { get; } = rustVersion;
|
||||||
|
|
||||||
|
public string MudBlazorVersion { get; } = mudBlazorVersion;
|
||||||
|
|
||||||
|
public string TauriVersion { get; } = tauriVersion;
|
||||||
|
|
||||||
|
public string AppCommitHash { get; } = appCommitHash;
|
||||||
|
}
|
@ -1,5 +1,8 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
|
<!-- Using Microsoft.Build.Tasks.Core.dll to be able to read files -->
|
||||||
|
<UsingTask TaskName="ReadLinesFromFile" AssemblyFile="$(MSBuildBinPath)\Microsoft.Build.Tasks.Core.dll" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
@ -29,7 +32,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- Remove launchSettings.json from the project -->
|
<!-- Remove some files from the solution view -->
|
||||||
<None Remove="Properties\launchSettings.json" />
|
<None Remove="Properties\launchSettings.json" />
|
||||||
<None Remove="build.nu" />
|
<None Remove="build.nu" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -45,4 +48,47 @@
|
|||||||
<PackageReference Include="MudBlazor.Markdown" Version="0.1.3" />
|
<PackageReference Include="MudBlazor.Markdown" Version="0.1.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<!-- Read the meta data file -->
|
||||||
|
<Target Name="ReadMetaData" BeforeTargets="BeforeBuild">
|
||||||
|
<Error Text="The ../../metadata.txt file was not found!" Condition="!Exists('../../metadata.txt')" />
|
||||||
|
|
||||||
|
<ReadLinesFromFile File="../../metadata.txt">
|
||||||
|
<Output TaskParameter="Lines" PropertyName="Metadata" />
|
||||||
|
</ReadLinesFromFile>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<MetaVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 0 ])</MetaVersion>
|
||||||
|
<MetaBuildTime>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 1 ])</MetaBuildTime>
|
||||||
|
<MetaBuild>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 2 ])</MetaBuild>
|
||||||
|
<MetaDotnetSdkVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 3 ])</MetaDotnetSdkVersion>
|
||||||
|
<MetaDotnetVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 4 ])</MetaDotnetVersion>
|
||||||
|
<MetaRustVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 5 ])</MetaRustVersion>
|
||||||
|
<MetaMudBlazorVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 6 ])</MetaMudBlazorVersion>
|
||||||
|
<MetaTauriVersion>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 7 ])</MetaTauriVersion>
|
||||||
|
<MetaAppCommitHash>$([System.String]::Copy( $(Metadata) ).Split( ';' )[ 8 ])</MetaAppCommitHash>
|
||||||
|
|
||||||
|
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
|
||||||
|
|
||||||
|
<AssemblyVersion>$(MetaVersion)</AssemblyVersion>
|
||||||
|
<FileVersion>$(MetaVersion)</FileVersion>
|
||||||
|
<InformationalVersion>$(MetaVersion)</InformationalVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<AssemblyAttribute Include="AIStudio.MetaDataAttribute">
|
||||||
|
<_Parameter1>$(MetaVersion)</_Parameter1>
|
||||||
|
<_Parameter2>$(MetaBuildTime)</_Parameter2>
|
||||||
|
<_Parameter3>$(MetaBuild)</_Parameter3>
|
||||||
|
<_Parameter3_TypeName>System.UInt32</_Parameter3_TypeName>
|
||||||
|
<_Parameter4>$(MetaDotnetSdkVersion)</_Parameter4>
|
||||||
|
<_Parameter5>$(MetaDotnetVersion)</_Parameter5>
|
||||||
|
<_Parameter6>$(MetaRustVersion)</_Parameter6>
|
||||||
|
<_Parameter7>$(MetaMudBlazorVersion)</_Parameter7>
|
||||||
|
<_Parameter8>$(MetaTauriVersion)</_Parameter8>
|
||||||
|
<_Parameter9>$(MetaAppCommitHash)</_Parameter9>
|
||||||
|
</AssemblyAttribute>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user