【问题标题】:.net maui application: cannot archive from visual studio mac command line.net maui application: cannot archive from visual studio mac command line
【发布时间】:2022-12-01 13:24:45
【问题描述】:

I am trying to publish my app on the app store. My project contains of the regular maui project and a middleware.data service that also needs to be build into the archive.

this is my csproj from that middleware.data:

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

  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <Compile Remove="ITodoService.cs" />
    <Compile Remove="Models\TodoItem.cs" />
    <Compile Remove="Models\TodoServiceEventArgs.cs" />
    <Compile Remove="MVVM\TodoListViewModel.cs" />
    <Compile Remove="Services\InMemoryTodoService.cs" />
    <Compile Remove="Services\InMemoryUserService.cs" />
    <Compile Remove="Services\RemoteTodoService.cs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Datasync.Client" Version="5.0.12" />
    <PackageReference Include="System.Linq.Async" Version="6.0.1" />
  </ItemGroup>

</Project>

As you can see, in the beginning it says the target framework is net6.0.

If I were to add ;net6.0-ios to the target frameworks, i can no longer build the data service.

Now, If I try to archive my ios project over the console:

 dotnet publish -f:net6.0-ios -c:Release -r ios-arm64

I get:

SkillbasedMiddleware.Data/obj/project.assets.json' doesn't have a target for 'net6.0-ios'. Ensure that restore has run and that you have included 'net6.0-ios' in the TargetFrameworks for your project.

and

The RuntimeIdentifier platform 'ios-arm64' and the PlatformTarget 'x64' must be compatible

if I try to archive without the runtime specified i also get:

A runtime identifier must be specified in order to publish this project.

I cant really seem to understand how to archive, can you guys help me out here?

【问题讨论】:

    标签: .net maui


    【解决方案1】:

    You could try adding the following in the .csproj file to check the RuntimeIdentifier:

    <PropertyGroup Condition="$(TargetFramework.Contains('-ios'))">
        <RuntimeIdentifier>ios-arm64</RuntimeIdentifier>
    </PropertyGroup>
    

    Hope it works for you.

    【讨论】:

      猜你喜欢
      • 2011-04-16
      • 2022-08-24
      • 2022-12-27
      • 2022-12-01
      • 2021-10-04
      • 2021-12-28
      • 2022-08-16
      • 2015-04-06
      • 1970-01-01
      相关资源
      最近更新 更多