What should I change in my Android .csproj file before uploading it to Google Play?

Kim Strasser 1,631 Reputation points
2025-11-04T13:07:55.73+00:00

I created a new Android project in VS Insiders and I added my files from my old VS 2022 Android project to the new project. But I have not changed my new .csproj file.

My new .csproj file in VS Insiders looks like this and debugging on my Android device works and I was able to create an archive in VS Insiders that I could upload to Google Play Internal Testing.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net9.0-android</TargetFramework>
    <SupportedOSPlatformVersion>31.0</SupportedOSPlatformVersion>
    <OutputType>Exe</OutputType>
    <ApplicationId>com.companyname.ProjectAndroid</ApplicationId>
    <ApplicationVersion>12</ApplicationVersion>     <ApplicationDisplayVersion>1.2</ApplicationDisplayVersion>
  </PropertyGroup>
  <ItemGroup>
    <None Remove="google-services.json" />
  </ItemGroup>
  <ItemGroup>
    <GoogleServicesJson Include="google-services.json" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
    <PackageReference Include="Microsoft.AppCenter.Analytics" Version="5.0.7" />
    <PackageReference Include="Microsoft.AppCenter.Crashes" Version="5.0.7" />
    <PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />
    <PackageReference Include="Microsoft.Maui.Core" Version="9.0.120" />
    <PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.120" />
    <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.4.1" />
    <PackageReference Include="MonoGame.Framework.Android" Version="3.8.4.1" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
    <PackageReference Include="PlayFabAllSDK" Version="1.205.250718" />
    <PackageReference Include="Plugin.InAppBilling" Version="9.1.0" />
    <PackageReference Include="Plugin.MediaManager" Version="1.2.2" />
    <PackageReference Include="Xamarin.AndroidX.Collection.Jvm" Version="1.5.0.3" />
    <PackageReference Include="Xamarin.AndroidX.Collection.Ktx" Version="1.5.0.3" />
    <PackageReference Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.17" />
    <PackageReference Include="Xamarin.AndroidX.Fragment.Ktx" Version="1.8.9" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Android" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx.Android" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModel.Ktx" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="2.9.3" />
    <PackageReference Include="Xamarin.AndroidX.Preference" Version="1.2.1.15" />
    <PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="1.3.2" />
    <PackageReference Include="Xamarin.Firebase.Messaging" Version="125.0.0.1" />
    <PackageReference Include="Xamarin.Google.Guava" Version="33.4.8.3" />
    <PackageReference Include="Xamarin.GooglePlayServices.Base" Version="118.8.0" />
  </ItemGroup>
  <Target Name="RestoreDotnetTools" BeforeTargets="Restore">
    <Message Text="Restoring dotnet tools" Importance="High" />
    <Exec Command="dotnet tool restore" />
  </Target>
  <Import Project="..\ProjectA\ProjectA.projitems" Label="Shared" />
  <Import Project="..\ProjectB\ProjectB.projitems" Label="Shared" />
  <Import Project="..\ProjectC\ProjectC.projitems" Label="Shared" />
</Project>

My old VS 2022 Android .csproj file is much bigger and I´m not sure which lines of code should be copied from my old .csproj file to my new .csproj file.

Which lines of code should I add to my new .csproj file before I upload my archive to Google Play? Can I use the same .csproj file code for both Google Play Internal Testing and distribution in the Google Play Store?

I have a proguard.cfg and a .keystore file in my Android project. Should both files always be included in the Android project when I upload an archive to Google Play?

My old VS 2022 .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net9.0-android</TargetFramework>
    <SupportedOSPlatformVersion>31.0</SupportedOSPlatformVersion>
    <OutputType>Exe</OutputType>
    <ApplicationId>com.companyname.ProjectAndroid</ApplicationId>
    <ApplicationVersion>12</ApplicationVersion>
    <ApplicationDisplayVersion>1.2</ApplicationDisplayVersion>
    <AndroidSigningKeyStore>androidkeystore.keystore</AndroidSigningKeyStore>
    <AndroidEnableR8>true</AndroidEnableR8>
      <!-- NOTE: not recommended for Debug builds! -->
      <AndroidLinkTool Condition="'$(Configuration)' == 'Release'">r8</AndroidLinkTool>
      <AndroidSupportedAbis>armeabi-v7a;arm64-v8a;x86;x86_64</AndroidSupportedAbis>
      <DebugType>portable</DebugType>
      <DebugSymbols>true</DebugSymbols> 
      <AndroidLinkMode>SdkOnly</AndroidLinkMode>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)'=='Release'">
  <AndroidGenerateNativeDebugSymbols>true</AndroidGenerateNativeDebugSymbols>
  <AndroidStripNativeDebugSymbols>false</AndroidStripNativeDebugSymbols>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <WarningLevel>4</WarningLevel>
    <NoStdLib>false</NoStdLib>
    <RuntimeIdentifiers>android-arm64;android-arm</RuntimeIdentifiers>
    <AndroidKeyStore>True</AndroidKeyStore>
    <AndroidSigningStorePass>...</AndroidSigningStorePass>
    <AndroidSigningKeyAlias>androidkeystore</AndroidSigningKeyAlias>
    <AndroidSigningKeyPass>...</AndroidSigningKeyPass>
    <EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <NoStdLib>false</NoStdLib>
    <AndroidKeyStore>True</AndroidKeyStore>
    <AndroidSigningStorePass>...</AndroidSigningStorePass>
    <AndroidSigningKeyAlias>androidkeystore</AndroidSigningKeyAlias>
    <AndroidSigningKeyPass>...</AndroidSigningKeyPass>
  </PropertyGroup>
…
  <ProjectExtensions><VisualStudio><UserProperties XamarinHotReloadDebuggerTimeoutExceptionProjectAndroidHideInfoBar="True" /></VisualStudio></ProjectExtensions>
</Project>

Developer technologies | .NET | .NET MAUI
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Le (WICLOUD CORPORATION) 3,935 Reputation points Microsoft External Staff Moderator
    2025-11-05T08:48:59.34+00:00

    Hello Kim,

    What your new .csproj file needs for Google Play Store

    Your current project file is missing several settings required by the Google Play Store. You will need to copy the following from your old VS 2022 project: signing settings, R8 optimization settings, architecture support, debug symbols, and the separate Debug/Release build configurations. You can copy these directly from your working VS 2022 project file into your new one.

    Can you use the same .csproj for both Internal Testing and Google Play Store?

    Yes, you can use the same .csproj file for both. The difference is controlled by your build configuration—Debug for testing and Release for the store. Internal Testing accepts debug builds, but the Google Play Store requires a properly signed release build.

    About your proguard.cfg and .keystore files

    Your proguard.cfg file is not needed because your project uses R8 optimization, which is Google's newer tool that replaced ProGuard. In case you still want to use ProGuard, you can include the proguard.cfg file and reference it in your project settings.

    <ItemGroup>
        <ProguardConfiguration Include="proguard.cfg" />
    </ItemGroup>
    

    Your .keystore file, however, is required for any Google Play upload. Please ensure it is included in your Android project and that the path in your project file is correct.

    I hope this helps clarify what you need. Please let me know if you have any other questions.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.