mirror of
https://github.com/jamesstringer90/appsandbox.git
synced 2026-10-19 01:31:28 -05:00
The Windows headless daemon reported its /version from a hardcoded ASB_PRODUCT_VER "0.1.2" in headless.c -- a second place to edit each release that could silently drift from the real build version. Pass AsbVersionShort (from Directory.Build.props, the single source of truth) into the C compile as an unquoted ASB_VERSION_SHORT define in Directory.Build.targets, and stringize it in headless.c, mirroring how build\version.rc already derives every binary VERSIONINFO. The /version response now tracks the build with no per-release edit; a fallback keeps a standalone (no-MSBuild) compile valid.
45 lines
2.4 KiB
XML
45 lines
2.4 KiB
XML
<Project>
|
|
<!--
|
|
Auto-embed a VERSIONINFO resource (driven by Directory.Build.props) into every EXE/DLL we
|
|
build, so FileVersion / ProductVersion / CompanyName come from the single source. Each
|
|
binary's OriginalFilename / InternalName / FILETYPE are derived from its own MSBuild
|
|
properties, so individual projects need no edits.
|
|
|
|
Opt-out: a project that sets <AsbEmbedVersion>false</AsbEmbedVersion> is skipped (the
|
|
drivers do this - they version via DriverVer/StampInf, not a binary VERSIONINFO). Utility
|
|
projects are skipped automatically by ConfigurationType.
|
|
|
|
This file is imported AFTER each project's body, so $(TargetName)/$(TargetFileName)/
|
|
$(ConfigurationType) are already resolved here.
|
|
-->
|
|
<PropertyGroup Condition="'$(AsbEmbedVersion)' == '' And ('$(ConfigurationType)' == 'Application' Or '$(ConfigurationType)' == 'DynamicLibrary')">
|
|
<AsbEmbedVersion>true</AsbEmbedVersion>
|
|
</PropertyGroup>
|
|
|
|
<PropertyGroup Condition="'$(AsbEmbedVersion)' == 'true'">
|
|
<AsbFileType Condition="'$(ConfigurationType)' == 'DynamicLibrary'">VFT_DLL</AsbFileType>
|
|
<AsbFileType Condition="'$(AsbFileType)' == ''">VFT_APP</AsbFileType>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup Condition="'$(AsbEmbedVersion)' == 'true'">
|
|
<ResourceCompile Include="$(MSBuildThisFileDirectory)build\version.rc" />
|
|
</ItemGroup>
|
|
|
|
<!-- Values are passed UNQUOTED and stringized inside version.rc (avoids quote-escaping
|
|
through MSBuild -> rc.exe). Filenames/versions contain no spaces, so this is safe. -->
|
|
<ItemDefinitionGroup Condition="'$(AsbEmbedVersion)' == 'true'">
|
|
<ResourceCompile>
|
|
<PreprocessorDefinitions>ASB_VERSION_COMMA=$(AsbVersionComma);ASB_VERSION_STR=$(AsbVersion);ASB_ORIG_FILENAME=$(TargetFileName);ASB_INTERNAL_NAME=$(TargetName);ASB_FILE_TYPE=$(AsbFileType);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
</ResourceCompile>
|
|
</ItemDefinitionGroup>
|
|
|
|
<!-- Make the version string available to C/C++ sources from the same single source, for
|
|
code that reports it at runtime (e.g. the headless API's /version response). Passed
|
|
UNQUOTED and stringized in the source, mirroring the version.rc injection above. -->
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<PreprocessorDefinitions>ASB_VERSION_SHORT=$(AsbVersionShort);%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
</ClCompile>
|
|
</ItemDefinitionGroup>
|
|
</Project>
|