question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to archive app if it references a .NET Standard 2.0 class library

See original GitHub issue

Description

We noticed an issue with a larger project where the code would not archive using the Visual Studio For Mac 2022 GUI. I realize this is possibly a tooling issue, but regardless I think it’s important to raise here.

Given a MauiApp that is ready for release, with no issues I would expect it to be able to be built for Release and able to be Archived, instead the following error occurs:

Assets file '/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/obj/project.assets.json' doesn't have a target for 'net6.0-maccatalyst'. Ensure that restore has run and that you have included 'net6.0-maccatalyst' in the TargetFrameworks for your project.

The project in question is a .net standard 2.0 project, it should have no knowledge of mac catalyst (which coincidentaly is the target on the visual studio gui).

Steps to Reproduce

I have reproduced this issue in a sample repo: MauiArchiveReproduction, reproduce by:

  • Building for release
  • Selecting “Archive for Publishing”

Link to public reproduction project repository

https://github.com/Axemasta/MauiArchiveReproduction

Version with bug

6.0 Release Candidate 2 or older

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

All I have tried

Did you find any workaround?

No

Relevant log output

Building ArchiveIssueReproduction (Release)
Build started 06/12/2022 16:53:54.
__________________________________________________
Project "/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/MyClassLib.csproj" (Build target(s)):

Target _BeforeCoreCompileImageAssets:
    Directory "obj/Release/net6.0-maccatalyst/actool" doesn't exist. Skipping.
Target _BeforeCoreCompileInterfaceDefinitions:
  Skipping target "_BeforeCoreCompileInterfaceDefinitions" because it has no inputs.
Target _BeforeCoreCompileInterfaceDefinitions:
  Skipping target "_BeforeCoreCompileInterfaceDefinitions" because it has no inputs.
Target _BeforeCoreCompileInterfaceDefinitions:
  Skipping target "_BeforeCoreCompileInterfaceDefinitions" because it has no inputs.
Target _CoreCompileInterfaceDefinitions:
  Skipping target "_CoreCompileInterfaceDefinitions" because it has no inputs.
Target _BeforeCoreCompileSceneKitAssets:
  Skipping target "_BeforeCoreCompileSceneKitAssets" because it has no inputs.
Target _BeforeCoreCompileSceneKitAssets:
  Skipping target "_BeforeCoreCompileSceneKitAssets" because it has no inputs.
Target _BeforeCoreCompileSceneKitAssets:
  Skipping target "_BeforeCoreCompileSceneKitAssets" because it has no inputs.
Target _CoreCompileSceneKitAssets:
  Skipping target "_CoreCompileSceneKitAssets" because it has no inputs.
Target _BeforeCompileTextureAtlases:
  Skipping target "_BeforeCompileTextureAtlases" because it has no inputs.
Target _BeforeCompileTextureAtlases:
  Skipping target "_BeforeCompileTextureAtlases" because it has no inputs.
Target _BeforeCompileTextureAtlases:
  Skipping target "_BeforeCompileTextureAtlases" because it has no inputs.
Target _CoreCompileTextureAtlases:
  Skipping target "_CoreCompileTextureAtlases" because it has no inputs.
Target _BeforeCompileCoreMLModels:
    Directory "obj/Release/net6.0-maccatalyst/coremlc" doesn't exist. Skipping.
Target PrepareForBuild:
    Creating directory "bin/Release/net6.0-maccatalyst/".
    Creating directory "/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/obj/Release/net6.0-maccatalyst/refint/".
    Creating directory "obj/Release/net6.0-maccatalyst/ref".
Target ResolvePackageAssets:
    /usr/local/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1005: Assets file '/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/obj/project.assets.json' doesn't have a target for 'net6.0-maccatalyst'. Ensure that restore has run and that you have included 'net6.0-maccatalyst' in the TargetFrameworks for your project.
Done building target "ResolvePackageAssets" in project "MyClassLib.csproj" -- FAILED.

Done building project "MyClassLib.csproj" -- FAILED.

Build FAILED.

/usr/local/share/dotnet/sdk/7.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1005: Assets file '/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/obj/project.assets.json' doesn't have a target for 'net6.0-maccatalyst'. Ensure that restore has run and that you have included 'net6.0-maccatalyst' in the TargetFrameworks for your project.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.19

Assets file '/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/obj/project.assets.json' doesn't have a target for 'net6.0-maccatalyst'. Ensure that restore has run and that you have included 'net6.0-maccatalyst' in the TargetFrameworks for your project.

Issue Analytics

  • State:open
  • Created 9 months ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Axemastacommented, Dec 6, 2022

@breenbob Same result unfortunately, command: dotnet publish -f:net6.0-ios -c:Release /p:ArchiveOnBuild=true /p:RuntimeIdentifier=ios-arm64

Output:

axemasta@Alexs-MacBook-Pro MauiArchiveReproduction % dotnet publish -f:net6.0-ios -c:Release /p:ArchiveOnBuild=true /p:RuntimeIdentifier=ios-arm64
MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
  Restored /Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/MyClassLib.csproj (in 309 ms).
  Restored /Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/ArchiveIssueReproduction/ArchiveIssueReproduction.csproj (in 377 ms).
/usr/local/share/dotnet/sdk/6.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(267,5): error NETSDK1005: Assets file '/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/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. [/Users/axemasta/Documents/GitHub/MauiArchiveReproduction/src/MyClassLib/MyClassLib.csproj]
0reactions
msftbot[bot]commented, Dec 8, 2022

We’ve moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

net Standard 2.0 class library produce error when adding ...
The system cannot find the file specified. I tested same library with project reference in .net core web application and there was no...
Read more >
Tutorial: Create a .NET class library using Visual Studio
In this tutorial, you create a simple class library that contains a single string-handling method. A class library defines types and methods ...
Read more >
Demystifying .NET Core and .NET Standard
NET Standard 2.0. That means you can reference the logic library not only from a .NET Core app, but also from an app...
Read more >
Please stop lying about .NET Standard 2.0 support!
In this post I have a bit of a rant about Microsoft's NuGet packages lying about supporting .NET Standard 2.0 when they kinda...
Read more >
Why isn't .NET Standard 2.0 used as the default compared ...
I know that .NET Framework and .NET Core are the implementation frameworks, while .NET Standard 2.0 is the specification that the frameworks ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found