From c994e49279e8093bd69cb03c568d21d3e3adf564 Mon Sep 17 00:00:00 2001 From: Howard Wolosky Date: Tue, 6 Aug 2019 16:32:13 -0700 Subject: [PATCH] Prevent Dev title from showing up on Store builds (#627) Commit 0722781fc updated the app to use `DevAppName` for the app's window title when it was a non-official build, based on the state of `IsStoreBuild`. Unfortunately, `IsStoreBuild` is a _project_ level variable defined in [build-app-internal.yaml](https://github.com/microsoft/calculator/blob/0722781fc60565938da42ea252766b30d02e5fb5/build/pipelines/templates/build-app-internal.yaml#L36), but not a _compile-time_ defined value. To solve this, we are now defining `IS_STORE_BUILD` in `Calculator.vcxproj` when `IsStoreBuild='True'`, the same way that we set `SEND_DIAGNOSTICS` for official builds, and we'll change the window title based on that new `#define`. Using this new `#define` can lead us down a slippery slope. We need to limit the amount of divergent code that we have between dev/official builds. This should be hopefully one of very few instances where this value is ever used. --- src/Calculator/Calculator.vcxproj | 2 +- src/Calculator/Views/TitleBar.xaml.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Calculator/Calculator.vcxproj b/src/Calculator/Calculator.vcxproj index 39400f1..b447758 100644 --- a/src/Calculator/Calculator.vcxproj +++ b/src/Calculator/Calculator.vcxproj @@ -216,7 +216,7 @@ - /DSEND_DIAGNOSTICS %(AdditionalOptions) + /DSEND_DIAGNOSTICS /DIS_STORE_BUILD %(AdditionalOptions) diff --git a/src/Calculator/Views/TitleBar.xaml.cpp b/src/Calculator/Views/TitleBar.xaml.cpp index c76f7b2..c4dcb95 100644 --- a/src/Calculator/Views/TitleBar.xaml.cpp +++ b/src/Calculator/Views/TitleBar.xaml.cpp @@ -36,11 +36,11 @@ namespace CalculatorApp Loaded += ref new RoutedEventHandler(this, &TitleBar::OnLoaded); Unloaded += ref new RoutedEventHandler(this, &TitleBar::OnUnloaded); -#ifdef IsStoreBuild +#ifdef IS_STORE_BUILD AppName->Text = AppResourceProvider::GetInstance().GetResourceString(L"AppName"); #else AppName->Text = AppResourceProvider::GetInstance().GetResourceString(L"DevAppName"); -#endif //IsStoreBuild +#endif //IS_STORE_BUILD } void TitleBar::OnLoaded(_In_ Object ^ /*sender*/, _In_ RoutedEventArgs ^ /*e*/)