Skip to content

Commit c787e71

Browse files
committed
Fix for Visual Studio not finding GitInfo.cs Ellendar#3
1 parent 7af2a45 commit c787e71

2 files changed

Lines changed: 25 additions & 20 deletions

File tree

CrossPlatformUI/CrossPlatformUI.csproj

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,30 @@
5858
</Target>
5959

6060
<Target Name="WriteGitInfoFile" DependsOnTargets="GenerateGitInfo" BeforeTargets="BeforeBuild">
61+
<PropertyGroup>
62+
<GitInfoText>
63+
// (auto-generated from .csproj)
64+
namespace Z2Randomizer;
6165

62-
<PropertyGroup>
63-
<GitInfoText>// (auto-generated from .csproj)
64-
namespace Z2Randomizer;
65-
public static class GitInfo {
66-
public static partial string Commit = &quot;$(GitHash)&quot;;
67-
public static partial string Branch = &quot;$(GitBranch)&quot;;
68-
public static partial bool IsDirty = $(IsDirtyValue);
69-
}
70-
</GitInfoText>
71-
</PropertyGroup>
66+
public static partial class GitInfo
67+
{
68+
static GitInfo()
69+
{
70+
Commit = "$(GitHash)";
71+
Branch = "$(GitBranch)";
72+
IsDirty = $(IsDirtyValue);
73+
}
74+
}
75+
</GitInfoText>
76+
</PropertyGroup>
7277

73-
<WriteLinesToFile
74-
File="$(IntermediateOutputPath)GitInfo.cs"
75-
Overwrite="true"
76-
Lines="$([System.Text.RegularExpressions.Regex]::Split('$(GitInfoText)', '\n'))" />
78+
<WriteLinesToFile
79+
File="$(IntermediateOutputPath)GitInfo.cs"
80+
Overwrite="true"
81+
Lines="$([System.Text.RegularExpressions.Regex]::Split('$(GitInfoText)', '\n'))" />
7782

78-
<ItemGroup>
79-
<Compile Include="$(IntermediateOutputPath)GitInfo.cs" />
80-
</ItemGroup>
83+
<ItemGroup>
84+
<Compile Include="$(IntermediateOutputPath)GitInfo.cs" />
85+
</ItemGroup>
8186
</Target>
8287
</Project>

CrossPlatformUI/GitInfo.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public static partial class GitInfo
44
{
5-
public static partial string Commit { get; }
6-
public static partial string Branch { get; }
7-
public static partial bool IsDirty { get; }
5+
public static string Commit { get; } = "n/a";
6+
public static string Branch { get; } = "n/a";
7+
public static bool IsDirty { get; }
88
}

0 commit comments

Comments
 (0)