Dumber_Texan2
Dumber_Texan2

Reputation: 978

Can't publish ASP.NET 7 or 8 Maui app targeting iOS using Visual Studio 17.8.3 packages in Azure DevOps

My app used to publish just fine using Azure DevOps when it was an ASP.NET 7 app targeting iOS 16.1 with a 15.4 supported framework. I was using the Visual Studio Enterprise 2022 17.5.3 packages.

I'm now trying to publish the app targeting iOS 17 with a 16.1 supported framework using the 17.8.3 packages.

The build is failing on the publish task. This is the last message before the errors.

/Users/runner/work/1/s/ViewModels/MainViewModel.cs(108,28): warning CS0108: 'MainViewModel.OnPropertyChanged(string)' hides inherited member 'ObservableObject.OnPropertyChanged(string?)'. Use the new keyword if hiding was intended. [/Users/runner/work/1/s/MyAppName.csproj::TargetFramework=net8.0-ios17.0]

Here is the error message:

##[error]Error: The process '/Users/runner/hostedtoolcache/dotnet/dotnet' failed with exit code 1
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : [ '/Users/runner/work/1/s/MyAppName.sln' ]
Finishing: dotnet publish (Debug)

Here are the upgrade instructions. https://github.com/dotnet/maui/wiki/Upgrading-.NET-MAUI-from-.NET-7-to-.NET-8

Has anyone else got this to work?

Upvotes: 0

Views: 775

Answers (1)

Dumber_Texan2
Dumber_Texan2

Reputation: 978

It's working now. I finally stopped using the Properties tab to make changes to the csproj. Here is what the config looks like now.

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-ios17.0|AnyCPU'">
  <MtouchUseLlvm>False</MtouchUseLlvm>
  <UseInterpreter>true</UseInterpreter>
  <MtouchLink>None</MtouchLink>
  <BuildIpa>True</BuildIpa>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios17.0|AnyCPU'">
  <MtouchUseLlvm>False</MtouchUseLlvm>
  <UseInterpreter>true</UseInterpreter>
  <MtouchLink>None</MtouchLink>
  <BuildIpa>True</BuildIpa>
</PropertyGroup>

In my case, I also saw the following error show up a few times.

error CS0246: The type or namespace name 'Android' could not be found (are you missing a using directive or an assembly reference?)

To fix this, I went to the file where the error occurred. I then commented out the Android using statements. They have been in the file since day 1, so I'm not sure why they all of a sudden caused Build / Publish issues.

Upvotes: 0

Related Questions