Assets file doesn't have a target for 'net6.0-android'

Dmitriy Reznik 236 Reputation points
2022-09-06T20:41:00.977+00:00

I tried to create a pipeline to build my .Net MAUI app on Azure DevOps. Besides the main MAUI project, the solution includes a UnitTests project with Target Framework .NET 6.0. The operation fails with the following error:

Error NETSDK1005: Assets file 'D:\a\1\s\UnitTests\obj\project.assets.json' doesn't have a target for 'net6.0-android'. Ensure that restore has run and that you have included 'net6.0-android' in the TargetFrameworks for your project.

I will probably be missing also framework(s) for iOS when I build a pipeline for it...

What is the right way to add those frameworks to my UnitTests project? And should it be done on my UnitTests project or as a pipeline task? And why in general does building UnitTests project require net6.0-android??

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,412 questions
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 74,491 Reputation points Microsoft Vendor
    2022-09-13T08:41:53.05+00:00

    Hello,

    I can build locally without problems. I am really confused why building UnitTests project requires net6.0-android... This project does not do anything currently, it is there for the future, and should not even know about MAUI...

    If you can build locally without issues, this issue is related to the Azure DevOps.
    Azure DevOps related questions are not supported on this forum. It's better to open a new thread in developer community

    Best Regards,

    Leon Lu


    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

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.