Target iOS version is always empty in my project's properties and I get an error

Kim Strasser 1,036 Reputation points
2023-09-21T10:20:19.4533333+00:00

I have installed Visual Studio for Mac 17.6.4 (build 472) and I always get this error when I build my iOS project:

/usr/local/share/dotnet/sdk/7.0.308/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(5,5): Error NETSDK1047: Assets file '/Users/myname/Projects/.../obj/project.assets.json' doesn't have a target for 'net7.0-ios16.4/iossimulator-x64'. Ensure that restore has run and that you have included 'net7.0-ios16.4' in the TargetFrameworks for your project. You may also need to include 'iossimulator-x64' in your project's RuntimeIdentifiers. (NETSDK1047)

In my project's properties the target iOS version is always empty, even after changing it to 16.4 and clicking the OK button.

Bildschirmfoto 2023-09-21 um 11.57.33

My project's csproj file looks like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net7.0-ios16.4</TargetFramework>
    <OutputType>Exe</OutputType>
    <UseMaui>true</UseMaui>
    <UseMauiEssentials>true</UseMauiEssentials>
    <SupportedOSPlatformVersion>15.0</SupportedOSPlatformVersion>

How can I solve this problem?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,106 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 28,761 Reputation points Microsoft Vendor
    2023-09-22T03:26:46.6633333+00:00

    Hi @Kim Strasser

    Welcome to Microsoft Q&A! 

    Please try to run dotnet restore to restore the project.

    Then, delete the obj folder in your project folder and rebuild the project. 

    If it doesn’t work, it may be a known issue in Visual Studio for MAC. You can see the similar issue

    Thanks for your understanding!

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

     


Your answer

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