Swift Package Manager: Validation / "no such file"

I'm trying to create a Command Line Tool that uses the ArgumentParser swift package.

I've added the package to my project, and initially I got a lot of errors:

Library not loaded

(code signature in PackageFrameworks/ArgumentParser.framework/Versions/A/ArgumentParser' not valid for use in process:

(no such file, not in dyld cache)

I fixed it by disabling Library Validation in the Build Options, and my tool runs in Xcode beautifully. But the compiled executable won't work in Terminal, flagging the same errors.

I presume it's some signing/security thing (as usual), and I just need to set the right Build Options, but I haven't a clue which ones. I tried "Always Embed Swift Libraries", but that produced a warning message:

the product type 'com.apple.product-type.tool' is not a wrapper type. Anyone know what might be going on?

One other thing which might be relevant: under Target > General > Frameworks and Libraries, I have the Argument Parser listed, but the "Embed" status is empty. I can't find a way to alter that.

ArgumentParser is listed in the Sidebar under Package Dependencies, but it's not under Frameworks. Should it be?

Also, assuming I get it working, am I going to embed all the example code and documentation in my CLI tool?

I'm on Ventura 13.2 beta and Xcode 14.1, btw.

If I copy the Argument Parser Frameworks from the Build folders to /Library/Frameworks, then my executable CLI tool works without error. But obviously, I want to build one executable, without having separate components to install and maintain.

How do you embed the Package in the executable?

OK, Apparently, you need to add a "Package.swift" file with some boilerplate, but the Package Manager doesn't do that when it adds a package to your project.

Swift Package Manager: Validation / "no such file"
 
 
Q