MAUI publish fails with error saying pack <packname> not present in workload manifests

Viewed 93

I'm trying to publish this Maui project which targets Android 10. I keep getting the following errors:

dotnet publish -f:net6.0-android -c:Release /p:AndroidSigningKeyPass=blah

MSBuild version 17.3.0+92e088760 for .NET Determining projects to restore... C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targe ts(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Ref.29' was not present in workload m anifests.

[C:\git\StockTrackMauiGui\StockTrackMauiGui\StockTrackMauiGui.csproj] C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targe ts(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.29.android-arm' was not present in workload manifests.

[C:\git\StockTrackMauiGui\StockTrackMauiGui\StockTrackMauiGui.csproj] C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targe ts(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.29.android-arm64' was not pre sent in workload manifests.

[C:\git\StockTrackMauiGui\StockTrackMauiGui\StockTrackMauiGui.csproj] C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targe ts(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.29.android-x86' was not prese nt in workload manifests.

[C:\git\StockTrackMauiGui\StockTrackMauiGui\StockTrackMauiGui.csproj] C:\Program Files\dotnet\sdk\6.0.400\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targe ts(90,5): error : NETSDKZZZZ: Error getting pack version: Pack 'Microsoft.Android.Runtime.29.android-x64' was not prese nt in workload manifests.

[C:\git\StockTrackMauiGui\StockTrackMauiGui\StockTrackMauiGui.csproj]

Here's the content of my csproj file:

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <TargetFrameworks>net6.0-maccatalyst;net6.0-android29.0</TargetFrameworks>
        <TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
        <!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
        <!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
        <OutputType>Exe</OutputType>
        <RootNamespace>StockTrackMauiGui</RootNamespace>
        <UseMaui>true</UseMaui>
        <SingleProject>true</SingleProject>
        <ImplicitUsings>enable</ImplicitUsings>

        <!-- Display name -->
        <ApplicationTitle>StockTrackMauiGui</ApplicationTitle>

        <!-- App Identifier -->
        <ApplicationId>com.kerry.stocktrackmauigui</ApplicationId>
        <ApplicationIdGuid>FE258B43-CAF4-425D-94F2-1ED061D420C3</ApplicationIdGuid>

        <!-- Versions -->
        <ApplicationDisplayVersion>0.79.5</ApplicationDisplayVersion>
        <ApplicationVersion>5</ApplicationVersion>

        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">29.0</SupportedOSPlatformVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
        <TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
        <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>

    <ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
    <CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
    <CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
    <CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
    <FileVersion>0.79.5.0</FileVersion>
    <AndroidSigningKeyStore>myapp.keystore</AndroidSigningKeyStore>
    <PlatformTarget>AnyCPU</PlatformTarget>

    <TargetPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">29</TargetPlatformVersion>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android|AnyCPU'">
      <EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
      <AndroidKeyStore>True</AndroidKeyStore>
      <AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-android|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
      <AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
      <AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
      <AndroidPackageFormat>apk</AndroidPackageFormat>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
      <AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
      <AndroidPackageFormat>apk</AndroidPackageFormat>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-maccatalyst|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-maccatalyst|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-windows10.0.19041.0|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
      <AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-windows10.0.19041.0|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
      <AndroidSigningKeyAlias>key</AndroidSigningKeyAlias>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-android29.0|AnyCPU'">
      <EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
      <AndroidKeyStore>True</AndroidKeyStore>
    </PropertyGroup>

    <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-android29.0|AnyCPU'">
      <AndroidKeyStore>True</AndroidKeyStore>
    </PropertyGroup>

    <ItemGroup>
        <!-- App Icon -->
        <MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />


        <!-- Images -->
        <MauiImage Include="Resources\Images\*" />
        <MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

        <!-- Custom Fonts -->
        <MauiFont Include="Resources\Fonts\*" />

        <!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
        <MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
    </ItemGroup>

    <ItemGroup>
      <None Remove="appsettings.json" />
      <None Remove="Resources\Splash\splashscreen.jpg" />
    </ItemGroup>

    <ItemGroup>
      <EmbeddedResource Include="appsettings.json">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </EmbeddedResource>
    </ItemGroup>

  <!-- Splash Screen -->
    <ItemGroup>
      <MauiSplashScreen Include="Resources\Splash\splashscreen.jpg" Color="#194067" ReSize="true" BaseSize="512,512">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
      </MauiSplashScreen>
    </ItemGroup>

    <ItemGroup>
      <PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
      <PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.0-preview.7.22376.2" />
      <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0-preview.6.22324.4" />
      <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
      <PackageReference Include="Zebra.Printer.SDK" Version="2.15.2634" />
    </ItemGroup>

    <ItemGroup>
      <ProjectReference Include="..\StockTrackMaui.Core\StockTrackMaui.Core.csproj" />
      <ProjectReference Include="..\StockTrackMaui.Infrastructure\StockTrackMaui.Infrastructure.csproj" />
    </ItemGroup>

    <ItemGroup>
      <MauiXaml Update="Views\Common\BinOrLocation.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
      <MauiXaml Update="Views\Common\Message.xaml">
        <Generator>MSBuild:Compile</Generator>
      </MauiXaml>
    </ItemGroup>

</Project>

Here's the content of my AndroidManifest.xml file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.kerry.stockcountmauigui" android:versionCode="6" android:versionName="v0.79.5">
    <application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true" android:label="StockCount"></application>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!--Coarse location is required for android 9 or lower, Fine location for android 11 or lower.-->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <!--Location for Sqlite database file to be on sdcard-->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- For discovery or to manipulate Bluetooth settings-->
    <uses-feature android:name="android.hardware.bluetooth" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
</manifest>

I installed all of the Android 10 system images Android10SystemImages

I've run the following commands -- I tend to think ZScaler or Beyond Trust is blocking some internet traffic. Here's the command and the results:

dotnet workload list

Installed Workload Ids      Manifest Version      Installation Source
--------------------------------------------------------------------------------
android                     32.0.448/6.0.400      SDK 6.0.400, VS 17.3.32825.248
maui                        6.0.486/6.0.400       SDK 6.0.400
maui-maccatalyst            6.0.486/6.0.400       VS 17.3.32825.248
maui-android                6.0.486/6.0.400       VS 17.3.32825.248
maccatalyst                 15.4.447/6.0.400      VS 17.3.32825.248
maui-ios                    6.0.486/6.0.400       VS 17.3.32825.248
ios                         15.4.447/6.0.400      VS 17.3.32825.248
maui-windows                6.0.486/6.0.400       VS 17.3.32825.248

I'm only targeting android 10 (SDK Platform 29)

I open a DOS window as administrator but Beyond Trust may or may not elevate when needed.

dotnet workload install maui

Inadequate permissions. Run the command with elevated privileges.

So I switch to my "supposedly local admin" account and run the same command

dotnet workload install android

Failed to update the advertising manifest microsoft.net.sdk.android: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.ios: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.macos: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maui: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.tvos: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.workload.emscripten: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Installing pack Microsoft.Android.Sdk.Windows version 32.0.448...
Pack Microsoft.Android.Sdk.Windows version 32.0.448 is already installed.
Writing workload pack installation record for Microsoft.Android.Sdk version 32.0.448...
Installing pack Microsoft.Android.Ref.31 version 32.0.448...
Pack Microsoft.Android.Ref.31 version 32.0.448 is already installed.
Writing workload pack installation record for Microsoft.Android.Ref.31 version 32.0.448...
Installing pack Microsoft.Android.Runtime.31.android-arm version 32.0.448...
Pack Microsoft.Android.Runtime.31.android-arm version 32.0.448 is already installed.
Writing workload pack installation record for Microsoft.Android.Runtime.31.android-arm version 32.0.448...
Installing pack Microsoft.Android.Runtime.31.android-arm64 version 32.0.448...
Pack Microsoft.Android.Runtime.31.android-arm64 version 32.0.448 is already installed.
Writing workload pack installation record for Microsoft.Android.Runtime.31.android-arm64 version 32.0.448...
Installing pack Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm version 6.0.8...
Pack Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm version 6.0.8 is already installed.
Writing workload pack installation record for Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm version 6.0.8...
Installing pack Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64 version 6.0.8...
Pack Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64 version 6.0.8 is already installed.
Writing workload pack installation record for Microsoft.NETCore.App.Runtime.AOT.Cross.android-arm64 version 6.0.8...
Garbage collecting for SDK feature band(s) 6.0.400...

Successfully installed workload(s) android.

I removed many lines of successfully installed packages due to hitting the 30000 character limit

dotnet workload install maui

Failed to update the advertising manifest microsoft.net.sdk.android: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.ios: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maccatalyst: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.macos: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.maui: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.sdk.tvos: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.workload.mono.toolchain: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Failed to update the advertising manifest microsoft.net.workload.emscripten: Unable to load the service index for source https://api.nuget.org/v3/index.json..
Installing pack Microsoft.Maui.Core.Ref.android version 6.0.486...
Pack Microsoft.Maui.Core.Ref.android version 6.0.486 is already installed.
Writing workload pack installation record for Microsoft.Maui.Core.Ref.android version 6.0.486...
Installing pack Microsoft.Maui.Essentials.Runtime.win version 6.0.486...
Pack Microsoft.Maui.Essentials.Runtime.win version 6.0.486 is already installed.
Writing workload pack installation record for Microsoft.Maui.Essentials.Runtime.win version 6.0.486...
Installing pack Microsoft.Maui.Graphics.Win2D.WinUI.Desktop version 6.0.403...
Pack Microsoft.Maui.Graphics.Win2D.WinUI.Desktop version 6.0.403 is already installed.
Writing workload pack installation record for Microsoft.Maui.Graphics.Win2D.WinUI.Desktop version 6.0.403...
Garbage collecting for SDK feature band(s) 6.0.400...

Successfully installed workload(s) maui android.

I removed many lines of successfully installed packages due to hitting the 30000 character limit.

Your assistance is much appreciated.

0 Answers
Related