-
Notifications
You must be signed in to change notification settings - Fork 64
Open
Description
Android framework version
net9.0-android
Affected platform version
.NET 9.0.301
Description
We have multiple google-services.json files, per environment.
In our build pipeline, we select the appropriate file like so:
<!-- Some variable that changes based on environment -->
<EntitlementsPostifx Condition="'$(ApplicationEnvironmentName)' != ''">$(ApplicationEnvironmentName)</EntitlementsPostifx>
<GoogleServicesPostfix>$(EntitlementsPostifx)</GoogleServicesPostfix>
<!-- Parameter that selects google sevrices json based on the environment -->
<GoogleServicesJson Condition="$(TargetFramework.Contains('-android'))" Include="Platforms\Android\google-services-$(GoogleServicesPostfix).json" />
We first build the entire solution (without providing the environment name), then we build the use dotnet publish
on the android project (MAUI) itself. But in the end an incorrect GoogleServicesJson is used - it uses the old one from when building the entire solution, because the target ProcessGoogleServicesJson is incorrectly skipped.
Steps to Reproduce
- New android app
- Setup GoogleServices
- Make GoogleServices change based on a variable, perhaps like so:
<GoogleServicesJson Include="Platforms\Android\google-services-$(AppEnvironment).json" />
- Build once
dotnet build xyz.csproj --property:AppEnvironment=Stage
- Do not
dotnet clean
- Build a second time
dotnet build xyz.csproj --property:AppEnvironment=Test
- The build skipped the ProcessGoogleServicesJson target, resulting in old configuration being used.
Did you find any workaround?
We use a workaround, that is not ideal.
<Target Name="InvalidateGoogleServicesStamp" BeforeTargets="ProcessGoogleServicesJson">
<Delete Files="$(IntermediateOutputPath)googsvcsjson.stamp" />
<Message Text="InvalidateGoogleServicesStamp: Deleted stamp file." Importance="high" />
</Target>
Relevant log output
Copilot
Metadata
Metadata
Assignees
Labels
No labels