mirror of
https://github.com/MSWS/TTT.git
synced 2025-12-05 22:20:25 -08:00
fix: Enable Git version info and fix JSON null handling
- Un-comment the `GenerateGitVersionInformation` target in `Versioning.csproj` to enable version information generation on non-Windows systems. - Remove the execution command previously used to compile and run the project in `Versioning.csproj`. - Adjust the path for the generated `gitversion.json` file in `Versioning.csproj`, moving it one directory up. - Update `Program.cs` to change the handling of null JSON values by assigning an empty string for string type, while keeping other JSON value conversions unchanged.
This commit is contained in:
@@ -39,7 +39,7 @@ foreach (var property in json.EnumerateObject()) {
|
||||
break;
|
||||
case JsonValueKind.Null:
|
||||
// No const nulls in C#, so use string.Empty or 0 as appropriate — or skip
|
||||
line = $" // {name} is null and omitted";
|
||||
line = $" public const string {name} = \"\";"; // Assuming string type
|
||||
break;
|
||||
default:
|
||||
// Skip unexpected structures like arrays/objects
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- <Target Name="GenerateGitVersionInformation" BeforeTargets="BeforeCompile" Condition="'$(OS)' != 'Windows_NT'">-->
|
||||
<!-- <Exec Command="dotnet-gitversion '$(ProjectDir)' > '$(ProjectDir)/gitversion.json'" />-->
|
||||
<!-- <Exec Command="dotnet run --project 'Versioning/Versioning.csproj'" />-->
|
||||
<!-- </Target>-->
|
||||
<Target Name="GenerateGitVersionInformation" BeforeTargets="BeforeCompile" Condition="'$(OS)' != 'Windows_NT'">
|
||||
<Exec Command="dotnet-gitversion '$(ProjectDir)' > '$(ProjectDir)/../gitversion.json'"/>
|
||||
</Target>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user