Git hash wird angezeigt und gespeichert
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@
|
||||
/KanSan.Base/bin/*
|
||||
/KanSan.Base/kansan.db
|
||||
/KanSan.Base/obj/*
|
||||
/KanSan/version.txt
|
||||
|
||||
@@ -6,6 +6,16 @@
|
||||
<UseWPF>true</UseWPF>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="version.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="version.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ilmerge" Version="3.0.29" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.1">
|
||||
@@ -25,4 +35,8 @@
|
||||
<ProjectReference Include="..\KanSan.Base\KanSan.Base.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
|
||||
<Exec Command="git rev-parse HEAD >"$(ProjectDir)\version.txt" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -27,6 +27,7 @@ namespace KanSan
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Title = ProgrammHashVersion.GIT_HASH;
|
||||
|
||||
UnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
var d = unitOfWork.KundenRepository.Get().First();
|
||||
|
||||
27
KanSan/ProgrammHashVersion.cs
Normal file
27
KanSan/ProgrammHashVersion.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan
|
||||
{
|
||||
public static class ProgrammHashVersion
|
||||
{
|
||||
public static string GIT_HASH
|
||||
{
|
||||
get
|
||||
{
|
||||
string gitVersion;
|
||||
|
||||
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("KanSan.version.txt"))
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
gitVersion = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
return gitVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user