Skip to content

Commit 7af2a45

Browse files
committed
Fix for Visual Studio not finding GitInfo.cs Ellendar#2
1 parent 518ec60 commit 7af2a45

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

CrossPlatformUI/CrossPlatformUI.csproj

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@
4444
<ProjectReference Include="..\RandomizerCore\RandomizerCore.csproj" />
4545
</ItemGroup>
4646

47-
<ItemGroup>
48-
<Compile Include="$(IntermediateOutputPath)GitInfo.cs"
49-
Condition="Exists('$(IntermediateOutputPath)GitInfo.cs') Or '$(DesignTimeBuild)' == 'true'" />
50-
</ItemGroup>
51-
5247
<Target Name="GenerateGitInfo" BeforeTargets="BeforeBuild">
5348
<MakeDir Directories="$(IntermediateOutputPath)" />
5449
<Exec Command="git rev-parse --short HEAD > $(IntermediateOutputPath)git-hash.txt" />
@@ -68,9 +63,9 @@
6863
<GitInfoText>// (auto-generated from .csproj)
6964
namespace Z2Randomizer;
7065
public static class GitInfo {
71-
public const string Commit = &quot;$(GitHash)&quot;;
72-
public const string Branch = &quot;$(GitBranch)&quot;;
73-
public const bool IsDirty = $(IsDirtyValue);
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);
7469
}
7570
</GitInfoText>
7671
</PropertyGroup>
@@ -79,5 +74,9 @@
7974
File="$(IntermediateOutputPath)GitInfo.cs"
8075
Overwrite="true"
8176
Lines="$([System.Text.RegularExpressions.Regex]::Split('$(GitInfoText)', '\n'))" />
77+
78+
<ItemGroup>
79+
<Compile Include="$(IntermediateOutputPath)GitInfo.cs" />
80+
</ItemGroup>
8281
</Target>
8382
</Project>

CrossPlatformUI/GitInfo.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Z2Randomizer;
2+
3+
public static partial class GitInfo
4+
{
5+
public static partial string Commit { get; }
6+
public static partial string Branch { get; }
7+
public static partial bool IsDirty { get; }
8+
}

0 commit comments

Comments
 (0)